use socket DONTROUTE flag instead of that in rcb_flags
[unix-history] / usr / src / sys / net / route.h
index 223e3ce..e99c847 100644 (file)
@@ -1,14 +1,16 @@
-/*     route.h 4.9     83/05/12        */
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ *     @(#)route.h     6.7 (Berkeley) %G%
+ */
 
 /*
  * Kernel resident routing tables.
  * 
 
 /*
  * Kernel resident routing tables.
  * 
- * The routing tables are initialized at boot time by
- * making entries for all directly connected interfaces.
- * Routing daemons can thereafter update the routing tables.
- *
- * TODO:
- *     keep statistics
+ * The routing tables are initialized when interface addresses
+ * are set by making entries for all directly connected interfaces.
  */
 
 /*
  */
 
 /*
@@ -19,9 +21,6 @@
 struct route {
        struct  rtentry *ro_rt;
        struct  sockaddr ro_dst;
 struct route {
        struct  rtentry *ro_rt;
        struct  sockaddr ro_dst;
-#ifdef notdef
-       caddr_t ro_pcb;                 /* not used yet */
-#endif
 };
 
 /*
 };
 
 /*
@@ -41,18 +40,42 @@ struct rtentry {
        u_long  rt_use;                 /* raw # packets forwarded */
        struct  ifnet *rt_ifp;          /* the answer: interface to use */
 };
        u_long  rt_use;                 /* raw # packets forwarded */
        struct  ifnet *rt_ifp;          /* the answer: interface to use */
 };
-#ifdef KERNEL
-#define        RTHASHSIZ       7
-struct mbuf *rthost[RTHASHSIZ];
-struct mbuf *rtnet[RTHASHSIZ];
-#endif
 
 #define        RTF_UP          0x1             /* route useable */
 #define        RTF_GATEWAY     0x2             /* destination is a gateway */
 #define        RTF_HOST        0x4             /* host entry (net otherwise) */
 
 #define        RTF_UP          0x1             /* route useable */
 #define        RTF_GATEWAY     0x2             /* destination is a gateway */
 #define        RTF_HOST        0x4             /* host entry (net otherwise) */
+#define RTF_REINSTATE  0x8             /* re-instate route after timeout */
+#define        RTF_DYNAMIC     0x10            /* created dynamically (by redirect) */
+
+/*
+ * Routing statistics.
+ */
+struct rtstat {
+       short   rts_badredirect;        /* bogus redirect calls */
+       short   rts_dynamic;            /* routes created by redirects */
+       short   rts_newgateway;         /* routes modified by redirects */
+       short   rts_unreach;            /* lookups which failed */
+       short   rts_wildcard;           /* lookups satisfied by a wildcard */
+};
 
 
+#ifdef KERNEL
 #define        RTFREE(rt) \
        if ((rt)->rt_refcnt == 1) \
                rtfree(rt); \
        else \
                (rt)->rt_refcnt--;
 #define        RTFREE(rt) \
        if ((rt)->rt_refcnt == 1) \
                rtfree(rt); \
        else \
                (rt)->rt_refcnt--;
+
+#ifdef GATEWAY
+#define        RTHASHSIZ       64
+#else
+#define        RTHASHSIZ       8
+#endif
+#if    (RTHASHSIZ & (RTHASHSIZ - 1)) == 0
+#define RTHASHMOD(h)   ((h) & (RTHASHSIZ - 1))
+#else
+#define RTHASHMOD(h)   ((h) % RTHASHSIZ)
+#endif
+struct mbuf *rthost[RTHASHSIZ];
+struct mbuf *rtnet[RTHASHSIZ];
+struct rtstat  rtstat;
+#endif