protocol change; byte swap those fields which need it; also add
authorSam Leffler <sam@ucbvax.Berkeley.EDU>
Thu, 26 May 1983 08:51:27 +0000 (00:51 -0800)
committerSam Leffler <sam@ucbvax.Berkeley.EDU>
Thu, 26 May 1983 08:51:27 +0000 (00:51 -0800)
a version stamp to allow future changes

SCCS-vsn: sbin/routed/af.c 4.11
SCCS-vsn: sbin/routed/if.c 4.3
SCCS-vsn: sbin/routed/input.c 4.4
SCCS-vsn: sbin/routed/main.c 4.5
SCCS-vsn: sbin/routed/output.c 4.3
SCCS-vsn: include/protocols/routed.h 4.9
SCCS-vsn: sbin/routed/startup.c 4.4
SCCS-vsn: sbin/routed/tables.c 4.3
SCCS-vsn: sbin/routed/timer.c 4.3
SCCS-vsn: sbin/routed/trace.c 4.3
SCCS-vsn: sbin/routed/trace.h 4.3

usr/src/include/protocols/routed.h
usr/src/sbin/routed/af.c
usr/src/sbin/routed/if.c
usr/src/sbin/routed/input.c
usr/src/sbin/routed/main.c
usr/src/sbin/routed/output.c
usr/src/sbin/routed/startup.c
usr/src/sbin/routed/tables.c
usr/src/sbin/routed/timer.c
usr/src/sbin/routed/trace.c
usr/src/sbin/routed/trace.h

index 668dd09..6636bcf 100644 (file)
@@ -1,4 +1,4 @@
-/*     routed.h        82/08/18        4.8     */
+/*     routed.h        83/05/25        4.9     */
 /*
  * Routing Information Protocol
  *
 /*
  * Routing Information Protocol
  *
@@ -6,6 +6,8 @@
  * by changing 32-bit net numbers to sockaddr's and
  * padding stuff to 32-bit boundaries.
  */
  * by changing 32-bit net numbers to sockaddr's and
  * padding stuff to 32-bit boundaries.
  */
+#define        RIPVERSION      1
+
 struct netinfo {
        struct  sockaddr rip_dst;       /* destination net/host */
        int     rip_metric;             /* cost of route */
 struct netinfo {
        struct  sockaddr rip_dst;       /* destination net/host */
        int     rip_metric;             /* cost of route */
@@ -13,7 +15,8 @@ struct netinfo {
 
 struct rip {
        u_char  rip_cmd;                /* request/response */
 
 struct rip {
        u_char  rip_cmd;                /* request/response */
-       u_char  rip_res1[3];            /* pad to 32-bit boundary */
+       u_char  rip_vers;               /* protocol version # */
+       u_char  rip_res1[2];            /* pad to 32-bit boundary */
        union {
                struct  netinfo ru_nets[1];     /* variable length... */
                char    ru_tracefile[1];        /* ditto ... */
        union {
                struct  netinfo ru_nets[1];     /* variable length... */
                char    ru_tracefile[1];        /* ditto ... */
@@ -22,6 +25,9 @@ struct rip {
 #define        rip_tracefile   ripun.ru_tracefile
 };
  
 #define        rip_tracefile   ripun.ru_tracefile
 };
  
+/*
+ * Packet types.
+ */
 #define        RIPCMD_REQUEST          1       /* want info */
 #define        RIPCMD_RESPONSE         2       /* responding to request */
 #define        RIPCMD_TRACEON          3       /* turn tracing on */
 #define        RIPCMD_REQUEST          1       /* want info */
 #define        RIPCMD_RESPONSE         2       /* responding to request */
 #define        RIPCMD_TRACEON          3       /* turn tracing on */
index b973c88..b53ee3f 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)af.c       4.10 %G%";
+static char sccsid[] = "@(#)af.c       4.11 (Berkeley) %G%";
 #endif
 
 #include "defs.h"
 #endif
 
 #include "defs.h"
index 4ac75b2..b8ca7b6 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)if.c       4.2 %G%";
+static char sccsid[] = "@(#)if.c       4.3 (Berkeley) %G%";
 #endif
 
 /*
 #endif
 
 /*
index 0d4034f..1a67228 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)input.c    4.3 %G%";
+static char sccsid[] = "@(#)input.c    4.4 (Berkeley) %G%";
 #endif
 
 /*
 #endif
 
 /*
@@ -36,6 +36,13 @@ rip_input(from, size)
                                break;
                        size -= sizeof (struct netinfo);
 
                                break;
                        size -= sizeof (struct netinfo);
 
+#ifdef notyet
+                       if (msg->rip_vers > 0) {
+                               n->rip_dst.sa_family =
+                                       ntohs(n->rip_dst.sa_family);
+                               n->rip_metric = ntohl(n->rip_metric);
+                       }
+#endif
                        /* 
                         * A single entry with sa_family == AF_UNSPEC and
                         * metric ``infinity'' means ``all routes''.
                        /* 
                         * A single entry with sa_family == AF_UNSPEC and
                         * metric ``infinity'' means ``all routes''.
@@ -48,6 +55,13 @@ rip_input(from, size)
                        rt = rtlookup(&n->rip_dst);
                        n->rip_metric = rt == 0 ? HOPCNT_INFINITY :
                                min(rt->rt_metric+1, HOPCNT_INFINITY);
                        rt = rtlookup(&n->rip_dst);
                        n->rip_metric = rt == 0 ? HOPCNT_INFINITY :
                                min(rt->rt_metric+1, HOPCNT_INFINITY);
+#ifdef notyet
+                       if (msg->rip_vers > 0) {
+                               n->rip_dst.sa_family =
+                                       htons(n->rip_dst.sa_family);
+                               n->rip_metric = htonl(n->rip_metric);
+                       }
+#endif
                        n++, newsize += sizeof (struct netinfo);
                }
                if (newsize > 0) {
                        n++, newsize += sizeof (struct netinfo);
                }
                if (newsize > 0) {
@@ -89,6 +103,13 @@ rip_input(from, size)
                for (; size > 0; size -= sizeof (struct netinfo), n++) {
                        if (size < sizeof (struct netinfo))
                                break;
                for (; size > 0; size -= sizeof (struct netinfo), n++) {
                        if (size < sizeof (struct netinfo))
                                break;
+#ifdef notyet
+                       if (msg->rip_vers > 0) {
+                               n->rip_dst.sa_family =
+                                       ntohs(n->rip_dst.sa_family);
+                               n->rip_metric = ntohl(n->rip_metric);
+                       }
+#endif
                        if (n->rip_metric >= HOPCNT_INFINITY)
                                continue;
                        rt = rtlookup(&n->rip_dst);
                        if (n->rip_metric >= HOPCNT_INFINITY)
                                continue;
                        rt = rtlookup(&n->rip_dst);
index e725ef8..a3d8aa8 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)main.c     4.4 %G%";
+static char sccsid[] = "@(#)main.c     4.5 (Berkeley) %G%";
 #endif
 
 /*
 #endif
 
 /*
@@ -76,7 +76,7 @@ main(argc, argv)
                for (t = 0; t < 20; t++)
                        if (t != s)
 #ifdef COMPAT
                for (t = 0; t < 20; t++)
                        if (t != s)
 #ifdef COMPAT
-                           if (t != snoroute)
+                               if (t != snoroute)
 #endif
                                (void) close(cc);
                (void) open("/", 0);
 #endif
                                (void) close(cc);
                (void) open("/", 0);
@@ -108,8 +108,13 @@ main(argc, argv)
        if (supplier < 0)
                supplier = 0;
        msg->rip_cmd = RIPCMD_REQUEST;
        if (supplier < 0)
                supplier = 0;
        msg->rip_cmd = RIPCMD_REQUEST;
+       msg->rip_vers = RIPVERSION;
        msg->rip_nets[0].rip_dst.sa_family = AF_UNSPEC;
        msg->rip_nets[0].rip_metric = HOPCNT_INFINITY;
        msg->rip_nets[0].rip_dst.sa_family = AF_UNSPEC;
        msg->rip_nets[0].rip_metric = HOPCNT_INFINITY;
+#ifdef notyet
+       msg->rip_nets[0].rip_dst.sa_family = htons(AF_UNSPEC);
+       msg->rip_nets[0].rip_metric = htonl(HOPCNT_INFINITY);
+#endif
        toall(sendmsg);
        sigset(SIGALRM, timer);
        timer();
        toall(sendmsg);
        sigset(SIGALRM, timer);
        timer();
index 7d88143..7074972 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)output.c   4.2 %G%";
+static char sccsid[] = "@(#)output.c   4.3 (Berkeley) %G%";
 #endif
 
 /*
 #endif
 
 /*
@@ -27,7 +27,7 @@ toall(f)
                dst = ifp->int_flags & IFF_BROADCAST ? &ifp->int_broadaddr :
                      ifp->int_flags & IFF_POINTOPOINT ? &ifp->int_dstaddr :
                      &ifp->int_addr;
                dst = ifp->int_flags & IFF_BROADCAST ? &ifp->int_broadaddr :
                      ifp->int_flags & IFF_POINTOPOINT ? &ifp->int_dstaddr :
                      &ifp->int_addr;
-               flags = ifp->int_flags & IFF_INTERFACE ? SOF_DONTROUTE : 0;
+               flags = ifp->int_flags & IFF_INTERFACE ? MSG_DONTROUTE : 0;
                (*f)(dst, flags, ifp);
        }
 }
                (*f)(dst, flags, ifp);
        }
 }
@@ -64,6 +64,7 @@ supply(dst, flags, ifp)
        int (*output)() = afswitch[dst->sa_family].af_output;
 
        msg->rip_cmd = RIPCMD_RESPONSE;
        int (*output)() = afswitch[dst->sa_family].af_output;
 
        msg->rip_cmd = RIPCMD_RESPONSE;
+       msg->rip_vers = RIPVERSION;
 again:
        for (rh = base; rh < &base[ROUTEHASHSIZ]; rh++)
        for (rt = rh->rt_forw; rt != (struct rt_entry *)rh; rt = rt->rt_forw) {
 again:
        for (rh = base; rh < &base[ROUTEHASHSIZ]; rh++)
        for (rt = rh->rt_forw; rt != (struct rt_entry *)rh; rt = rt->rt_forw) {
@@ -75,6 +76,10 @@ again:
                }
                n->rip_dst = rt->rt_dst;
                n->rip_metric = min(rt->rt_metric + 1, HOPCNT_INFINITY);
                }
                n->rip_dst = rt->rt_dst;
                n->rip_metric = min(rt->rt_metric + 1, HOPCNT_INFINITY);
+#ifdef notyet
+               n->rip_dst.sa_family = htons(n->rip_dst.sa_family);
+               n->rip_metric = htonl(n->rip_metric);
+#endif
                n++;
        }
        if (doinghost) {
                n++;
        }
        if (doinghost) {
index 67ffafe..1747b66 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)startup.c  4.3 %G%";
+static char sccsid[] = "@(#)startup.c  4.4 (Berkeley) %G%";
 #endif
 
 /*
 #endif
 
 /*
index 915f7a6..5796c42 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)tables.c   4.2 %G%";
+static char sccsid[] = "@(#)tables.c   4.3 (Berkeley) %G%";
 #endif
 
 /*
 #endif
 
 /*
index 954ca7c..f6da47b 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)timer.c    4.2 %G%";
+static char sccsid[] = "@(#)timer.c    4.3 (Berkeley) %G%";
 #endif
 
 /*
 #endif
 
 /*
@@ -54,9 +54,16 @@ again:
                                if (!supplier || timetobroadcast)
                                        continue;
                                msg->rip_cmd = RIPCMD_RESPONSE;
                                if (!supplier || timetobroadcast)
                                        continue;
                                msg->rip_cmd = RIPCMD_RESPONSE;
+                               msg->rip_vers = RIPVERSION;
                                msg->rip_nets[0].rip_dst = rt->rt_dst;
                                msg->rip_nets[0].rip_metric =
                                msg->rip_nets[0].rip_dst = rt->rt_dst;
                                msg->rip_nets[0].rip_metric =
-                                   min(rt->rt_metric+1, HOPCNT_INFINITY);
+                                  min(rt->rt_metric+1, HOPCNT_INFINITY);
+#ifdef notyet
+                               msg->rip_nets[0].rip_dst.sa_family =
+                                  htons(msg->rip_nets[0].rip_dst.sa_family);
+                               msg->rip_nets[0].rip_metric =
+                                  htonl(msg->rip_nets[0].rip_metric);
+#endif
                                toall(sendmsg);
                        }
                }
                                toall(sendmsg);
                        }
                }
index 8c446b5..f0c2d04 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)trace.c    4.2 %G%";
+static char sccsid[] = "@(#)trace.c    4.3 (Berkeley) %G%";
 #endif
 
 /*
 #endif
 
 /*
index 0ee3ebb..48a15e0 100644 (file)
@@ -1,4 +1,4 @@
-/*     trace.h 4.2     83/01/31        */
+/*     trace.h 4.3     83/05/25        */
 
 /*
  * Routing table management daemon.
 
 /*
  * Routing table management daemon.
@@ -43,7 +43,7 @@ FILE  *ftrace;                /* output trace file */
                ifp = if_iflookup(src); \
                if (ifp) \
                        trace(&ifp->int_input, src, packet, size, \
                ifp = if_iflookup(src); \
                if (ifp) \
                        trace(&ifp->int_input, src, packet, size, \
-                               ifp->int_metric); \
+                               ntohl(ifp->int_metric)); \
          } \
          if (tracepackets) \
                dumppacket(stdout, "from", src, packet, size); \
          } \
          if (tracepackets) \
                dumppacket(stdout, "from", src, packet, size); \