Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/routed sync with routed 2.27



details:   https://anonhg.NetBSD.org/src/rev/226e1dceca6b
branches:  trunk
changeset: 539972:226e1dceca6b
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Nov 30 04:04:23 2002 +0000

description:
sync with routed 2.27

diffstat:

 sbin/routed/defs.h            |  15 +++++--
 sbin/routed/if.c              |  13 +++---
 sbin/routed/input.c           |  45 ++++++++++++++---------
 sbin/routed/main.c            |  10 ++--
 sbin/routed/output.c          |  24 +++++++-----
 sbin/routed/parms.c           |  54 ++++++++++++++++++++++------
 sbin/routed/rdisc.c           |   9 ++--
 sbin/routed/routed.8          |  81 +++++++++++++++++++++++++++++++-----------
 sbin/routed/rtquery/rtquery.c |  44 +++++++++++++++-------
 sbin/routed/table.c           |  63 ++++++++++++++++++---------------
 sbin/routed/trace.c           |  17 ++++++--
 11 files changed, 246 insertions(+), 129 deletions(-)

diffs (truncated from 952 to 300 lines):

diff -r 8185fac95cc0 -r 226e1dceca6b sbin/routed/defs.h
--- a/sbin/routed/defs.h        Sat Nov 30 04:02:19 2002 +0000
+++ b/sbin/routed/defs.h        Sat Nov 30 04:04:23 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.21 2001/11/02 05:30:56 lukem Exp $  */
+/*     $NetBSD: defs.h,v 1.22 2002/11/30 04:04:23 christos Exp $       */
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -35,7 +35,7 @@
  *     @(#)defs.h      8.1 (Berkeley) 6/5/93
  *
  *     $FreeBSD$
- *     "Revision: 2.23 "
+ *     "Revision: 2.27 "
  */
 
 /* Definitions for RIPv2 routing process.
@@ -133,7 +133,7 @@
 
 /* Turn on if IP_DROP_MEMBERSHIP and IP_ADD_MEMBERSHIP do not look at
  * the dstaddr of point-to-point interfaces.
-#undef MCAST_PPP_BUG
+ * #define MCAST_PPP_BUG
  */
 #ifdef MCAST_IFINDEX
 #undef MCAST_PPP_BUG
@@ -303,7 +303,9 @@
        time_t  int_query_time;
        u_short int_transitions;        /* times gone up-down */
        char    int_metric;
-       char    int_d_metric;           /* for faked default route */
+       u_char  int_d_metric;           /* for faked default route */
+       u_char  int_adj_inmetric;       /* adjust advertised metrics */
+       u_char  int_adj_outmetric;      /*    instead of interface metric */
        struct int_data {
                u_int   ipackets;       /* previous network stats */
                u_int   ierrors;
@@ -412,7 +414,9 @@
        naddr   parm_net;
        naddr   parm_mask;
 
-       char    parm_d_metric;
+       u_char  parm_d_metric;
+       u_char  parm_adj_inmetric;
+       u_char  parm_adj_outmetric;
        u_int   parm_int_state;
        int     parm_rdisc_pref;        /* signed IRDP preference */
        int     parm_rdisc_int;         /* IRDP advertising interval */
@@ -470,6 +474,7 @@
 extern int     rt_sock_seqno;
 extern int     rdisc_sock;             /* router-discovery raw socket */
 
+extern int     seqno;                  /* sequence number for messages */
 extern int     supplier;               /* process should supply updates */
 extern int     supplier_set;           /* -s or -q requested */
 extern int     lookforinterfaces;      /* 1=probe for new up interfaces */
diff -r 8185fac95cc0 -r 226e1dceca6b sbin/routed/if.c
--- a/sbin/routed/if.c  Sat Nov 30 04:02:19 2002 +0000
+++ b/sbin/routed/if.c  Sat Nov 30 04:04:23 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.23 2001/11/02 05:30:56 lukem Exp $    */
+/*     $NetBSD: if.c,v 1.24 2002/11/30 04:04:23 christos Exp $ */
 
 /*
  * Copyright (c) 1983, 1993
@@ -37,12 +37,12 @@
 #include "pathnames.h"
 
 #ifdef __NetBSD__
-__RCSID("$NetBSD: if.c,v 1.23 2001/11/02 05:30:56 lukem Exp $");
+__RCSID("$NetBSD: if.c,v 1.24 2002/11/30 04:04:23 christos Exp $");
 #elif defined(__FreeBSD__)
 __RCSID("$FreeBSD$");
 #else
-__RCSID("Revision: 2.24 ");
-#ident "Revision: 2.24 "
+__RCSID("Revision: 2.27 ");
+#ident "Revision: 2.27 "
 #endif
 
 struct interface *ifnet;               /* all interfaces */
@@ -745,9 +745,8 @@
                ifam2 = (struct ifa_msghdr*)((char*)ifam + ifam->ifam_msglen);
 
 #ifdef RTM_OIFINFO
-               if (ifam->ifam_type == RTM_OIFINFO) {
-                       continue; /* just ignore compat message */
-               }
+               if (ifam->ifam_type == RTM_OIFINFO)
+                       continue;       /* just ignore compat message */
 #endif
                if (ifam->ifam_type == RTM_IFINFO) {
                        struct sockaddr_dl *sdl;
diff -r 8185fac95cc0 -r 226e1dceca6b sbin/routed/input.c
--- a/sbin/routed/input.c       Sat Nov 30 04:02:19 2002 +0000
+++ b/sbin/routed/input.c       Sat Nov 30 04:04:23 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: input.c,v 1.27 2001/03/10 23:52:45 christos Exp $      */
+/*     $NetBSD: input.c,v 1.28 2002/11/30 04:04:23 christos Exp $      */
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -36,12 +36,12 @@
 #include "defs.h"
 
 #ifdef __NetBSD__
-__RCSID("$NetBSD: input.c,v 1.27 2001/03/10 23:52:45 christos Exp $");
+__RCSID("$NetBSD: input.c,v 1.28 2002/11/30 04:04:23 christos Exp $");
 #elif defined(__FreeBSD__)
 __RCSID("$FreeBSD$");
 #else
-__RCSID("Revision: 2.23 ");
-#ident "Revision: 2.23 "
+__RCSID("Revision: 2.26 ");
+#ident "Revision: 2.26 "
 #endif
 
 static void input(struct sockaddr_in *, struct interface *, struct interface *,
@@ -329,9 +329,14 @@
                                        v12buf.n->n_family = RIP_AF_INET;
                                        v12buf.n->n_dst = RIP_DEFAULT;
                                        i = aifp->int_d_metric;
-                                       if (0 != (rt = rtget(RIP_DEFAULT, 0)))
-                                           i = MIN(i, (rt->rt_metric
-                                                       +aifp->int_metric+1));
+                                       if (0 != (rt = rtget(RIP_DEFAULT, 0))) {
+                                           j = (rt->rt_metric
+                                                +aifp->int_metric
+                                                +aifp->int_adj_outmetric
+                                                +1);
+                                           if (i > j)
+                                               i = j;
+                                       }
                                        v12buf.n->n_metric = htonl(i);
                                        v12buf.n++;
                                        break;
@@ -397,11 +402,15 @@
                                 */
                                v12buf.n->n_family = RIP_AF_INET;
                                v12buf.n->n_dst = dst;
-                               v12buf.n->n_metric = (rt->rt_metric+1
-                                                     + ((aifp!=0)
-                                                         ? aifp->int_metric
-                                                         : 1));
-                               if (v12buf.n->n_metric > HOPCNT_INFINITY)
+                               j = rt->rt_metric+1;
+                               if (!aifp)
+                                       ++j;
+                               else
+                                       j += (aifp->int_metric
+                                             + aifp->int_adj_outmetric);
+                               if (j < HOPCNT_INFINITY)
+                                       v12buf.n->n_metric = j;
+                               else
                                        v12buf.n->n_metric = HOPCNT_INFINITY;
                                if (v12buf.buf->rip_vers != RIPv1) {
                                        v12buf.n->n_tag = rt->rt_tag;
@@ -666,7 +675,8 @@
 
                        /* Adjust metric according to incoming interface..
                         */
-                       n->n_metric += aifp->int_metric;
+                       n->n_metric += (aifp->int_metric
+                                       + aifp->int_adj_inmetric);
                        if (n->n_metric > HOPCNT_INFINITY)
                                n->n_metric = HOPCNT_INFINITY;
 
@@ -979,12 +989,12 @@
                         */
                        if (TRACEPACKETS) {
                                if (NA->au.a_md5.md5_auth_len
-                                   != RIP_AUTH_MD5_LEN)
+                                   != RIP_AUTH_MD5_HASH_LEN)
                                        msglim(use_authp, from,
                                               "unknown MD5 RIPv2 auth len %#x"
                                               " instead of %#x from %s",
                                               NA->au.a_md5.md5_auth_len,
-                                              RIP_AUTH_MD5_LEN,
+                                              RIP_AUTH_MD5_HASH_LEN,
                                               naddr_ntoa(from));
                                if (na2->a_family != RIP_AF_AUTH)
                                        msglim(use_authp, from,
@@ -1001,8 +1011,9 @@
                        }
 
                        MD5Init(&md5_ctx);
-                       MD5Update(&md5_ctx, (u_char *)rip, len);
-                       MD5Update(&md5_ctx, ap->key, RIP_AUTH_MD5_LEN);
+                       MD5Update(&md5_ctx, (u_char *)rip,
+                                 len + RIP_AUTH_MD5_HASH_XTRA);
+                       MD5Update(&md5_ctx, ap->key, RIP_AUTH_MD5_KEY_LEN);
                        MD5Final(hash, &md5_ctx);
                        if (!memcmp(hash, na2->au.au_pw, sizeof(hash)))
                                return 1;
diff -r 8185fac95cc0 -r 226e1dceca6b sbin/routed/main.c
--- a/sbin/routed/main.c        Sat Nov 30 04:02:19 2002 +0000
+++ b/sbin/routed/main.c        Sat Nov 30 04:04:23 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.30 2001/11/02 05:30:56 lukem Exp $  */
+/*     $NetBSD: main.c,v 1.31 2002/11/30 04:04:23 christos Exp $       */
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -46,12 +46,12 @@
            "The Regents of the University of California."
            "  All rights reserved.\n");
 #ifdef __NetBSD__
-__RCSID("$NetBSD: main.c,v 1.30 2001/11/02 05:30:56 lukem Exp $");
+__RCSID("$NetBSD: main.c,v 1.31 2002/11/30 04:04:23 christos Exp $");
 #elif defined(__FreeBSD__)
 __RCSID("$FreeBSD$");
 #else
-__RCSID("Revision: 2.24 ");
-#ident "Revision: 2.24 "
+__RCSID("Revision: 2.27 ");
+#ident "Revision: 2.27 "
 #endif
 
 #if defined(__NetBSD__)
@@ -226,7 +226,7 @@
                case 'v':
                        /* display version */
                        verbose++;
-                       msglog("version 2.24");
+                       msglog("version 2.25");
                        break;
 
                default:
diff -r 8185fac95cc0 -r 226e1dceca6b sbin/routed/output.c
--- a/sbin/routed/output.c      Sat Nov 30 04:02:19 2002 +0000
+++ b/sbin/routed/output.c      Sat Nov 30 04:04:23 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: output.c,v 1.21 2001/11/02 05:30:56 lukem Exp $        */
+/*     $NetBSD: output.c,v 1.22 2002/11/30 04:04:23 christos Exp $     */
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -36,12 +36,12 @@
 #include "defs.h"
 
 #ifdef __NetBSD__
-__RCSID("$NetBSD: output.c,v 1.21 2001/11/02 05:30:56 lukem Exp $");
+__RCSID("$NetBSD: output.c,v 1.22 2002/11/30 04:04:23 christos Exp $");
 #elif defined(__FreeBSD__)
 __RCSID("$FreeBSD$");
 #else
-__RCSID("Revision: 2.23 ");
-#ident "Revision: 2.23 "
+__RCSID("Revision: 2.27 ");
+#ident "Revision: 2.27 "
 #endif
 
 
@@ -286,7 +286,7 @@
                na->a_family = RIP_AF_AUTH;
                na->a_type = RIP_AUTH_MD5;
                na->au.a_md5.md5_keyid = ap->keyid;
-               na->au.a_md5.md5_auth_len = RIP_AUTH_MD5_LEN;
+               na->au.a_md5.md5_auth_len = RIP_AUTH_MD5_KEY_LEN;
                na->au.a_md5.md5_seqno = htonl(clk.tv_sec);
                wb->n++;
                wb->lim--;              /* make room for trailer */
@@ -310,8 +310,8 @@
        na2->a_type = htons(1);
        na->au.a_md5.md5_pkt_len = htons(len);
        MD5Init(&md5_ctx);
-       MD5Update(&md5_ctx, (u_char *)wb->buf, len);
-       MD5Update(&md5_ctx, ap->key, RIP_AUTH_MD5_LEN);
+       MD5Update(&md5_ctx, (u_char *)wb->buf, len + RIP_AUTH_MD5_HASH_XTRA);
+       MD5Update(&md5_ctx, ap->key, RIP_AUTH_MD5_KEY_LEN);
        MD5Final(na2->au.au_pw, &md5_ctx);
        wb->n++;
 }
@@ -554,8 +554,7 @@
                 * without confusing RIPv1 listeners into thinking the
                 * network routes are host routes.
                 */
-               if ((ws.state & WS_ST_AG)
-                   && !(ws.state & WS_ST_RIP2_ALL))
+               if ((ws.state & WS_ST_AG) && (ws.state & WS_ST_RIP2_ALL))
                        ags |= AGS_AGGREGATE;
 
        } else {
@@ -599,6 +598,11 @@
         *
         * Notice spare routes with the same metric that we are about to
         * advertise, to split the horizon on redundant, inactive paths.
+        *
+        * Do not suppress advertisements of interface-related addresses on
+        * non-point-to-point interfaces.  This ensures that we have something
+        * to say every 30 seconds to help detect broken Ethernets or
+        * other interfaces where one packet every 30 seconds costs nothing.
         */
        if (ws.ifp != 0
            && !(ws.state & WS_ST_QUERY)
@@ -718,7 +722,7 @@
                /* Adjust the advertised metric by the outgoing interface
                 * metric.
                 */



Home | Main Index | Thread Index | Old Index