Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/ndp remove unused ancient code and widen v6 address...



details:   https://anonhg.NetBSD.org/src/rev/cb8a5668d42b
branches:  trunk
changeset: 347858:cb8a5668d42b
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Sep 19 19:13:14 2016 +0000

description:
remove unused ancient code and widen v6 address so that columns are aligned.

diffstat:

 usr.sbin/ndp/ndp.c |  35 +++++++++++------------------------
 1 files changed, 11 insertions(+), 24 deletions(-)

diffs (68 lines):

diff -r f38c17d6886a -r cb8a5668d42b usr.sbin/ndp/ndp.c
--- a/usr.sbin/ndp/ndp.c        Mon Sep 19 19:07:53 2016 +0000
+++ b/usr.sbin/ndp/ndp.c        Mon Sep 19 19:13:14 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ndp.c,v 1.47 2016/04/04 07:37:08 ozaki-r Exp $ */
+/*     $NetBSD: ndp.c,v 1.48 2016/09/19 19:13:14 christos Exp $        */
 /*     $KAME: ndp.c,v 1.121 2005/07/13 11:30:13 keiichi Exp $  */
 
 /*
@@ -507,7 +507,7 @@
        return 0;
 }
 
-#define W_ADDR 36
+#define W_ADDR (8 * 4 + 7)
 #define W_LL   17
 #define W_IF   6
 
@@ -528,14 +528,14 @@
        int addrwidth;
        int llwidth;
        int ifwidth;
-       char flgbuf[8];
+       char flgbuf[8], *fl;
        const char *ifname;
 
        /* Print header */
        if (!tflag && !cflag)
-               (void)printf("%-*.*s %-*.*s %*.*s %-9.9s %1s %5s\n",
+               (void)printf("%-*.*s %-*.*s %*.*s %-9.9s %1s %2s\n",
                    W_ADDR, W_ADDR, "Neighbor", W_LL, W_LL, "Linklayer Address",
-                   W_IF, W_IF, "Netif", "Expire", "S", "Flags");
+                   W_IF, W_IF, "Netif", "Expire", "S", "Fl");
 
 again:;
        mib[0] = CTL_NET;
@@ -676,25 +676,12 @@
                /*
                 * other flags. R: router, P: proxy, W: ??
                 */
-               if ((rtm->rtm_addrs & RTA_NETMASK) == 0) {
-                       (void)snprintf(flgbuf, sizeof(flgbuf), "%s%s",
-                           isrouter ? "R" : "",
-                           (rtm->rtm_flags & RTF_ANNOUNCE) ? "p" : "");
-               } else {
-                       mysin = (struct sockaddr_in6 *)(void *)
-                           (sdl->sdl_len + (char *)(void *)sdl);
-#if 0  /* W and P are mystery even for us */
-                       (void)snprintf(flgbuf, sizeof(flgbuf), "%s%s%s%s",
-                           isrouter ? "R" : "",
-                           !IN6_IS_ADDR_UNSPECIFIED(&sin->sin6_addr) ? "P" : "",
-                           (sin->sin6_len != sizeof(struct sockaddr_in6)) ? "W" : "",
-                           (rtm->rtm_flags & RTF_ANNOUNCE) ? "p" : "");
-#else
-                       (void)snprintf(flgbuf, sizeof(flgbuf), "%s%s",
-                           isrouter ? "R" : "",
-                           (rtm->rtm_flags & RTF_ANNOUNCE) ? "p" : "");
-#endif
-               }
+               fl = flgbuf;
+               if (isrouter)
+                       *fl++ = 'R';
+               if (rtm->rtm_flags & RTF_ANNOUNCE)
+                       *fl++ = 'p';
+               *fl++ = '\0';
                (void)printf(" %s", flgbuf);
 
                if (prbs)



Home | Main Index | Thread Index | Old Index