as pointed out by mpi, the kernel no longer tracks this information.

OK?

diff --git sys/netinet/icmp6.h sys/netinet/icmp6.h
index bfa5a196c70..bf8524c2da1 100644
--- sys/netinet/icmp6.h
+++ sys/netinet/icmp6.h
@@ -513,9 +513,7 @@ struct icmp6stat {
 #define ICMPV6CTL_MTUDISC_HIWAT        16
 #define ICMPV6CTL_MTUDISC_LOWAT        17
 #define ICMPV6CTL_ND6_DEBUG    18
-#define ICMPV6CTL_ND6_DRLIST   19
-#define ICMPV6CTL_ND6_PRLIST   20
-#define ICMPV6CTL_MAXID                21
+#define ICMPV6CTL_MAXID                19
 
 #define ICMPV6CTL_NAMES { \
        { 0, 0 }, \
@@ -537,8 +535,6 @@ struct icmp6stat {
        { "mtudisc_hiwat", CTLTYPE_INT }, \
        { "mtudisc_lowat", CTLTYPE_INT }, \
        { "nd6_debug", CTLTYPE_INT }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
 }
 
 #define ICMPV6CTL_VARS { \
@@ -561,8 +557,6 @@ struct icmp6stat {
        &icmp6_mtudisc_hiwat, \
        &icmp6_mtudisc_lowat, \
        &nd6_debug, \
-       NULL, \
-       NULL, \
 }
 
 #define RTF_PROBEMTU   RTF_PROTO1
diff --git sys/netinet6/icmp6.c sys/netinet6/icmp6.c
index 61facf80bcf..23b0d2d58d8 100644
--- sys/netinet6/icmp6.c
+++ sys/netinet6/icmp6.c
@@ -1904,9 +1904,6 @@ icmp6_sysctl(int *name, u_int namelen, void *oldp, size_t 
*oldlenp,
 
        case ICMPV6CTL_STATS:
                return icmp6_sysctl_icmp6stat(oldp, oldlenp, newp);
-       case ICMPV6CTL_ND6_DRLIST:
-       case ICMPV6CTL_ND6_PRLIST:
-               return nd6_sysctl(name[0], oldp, oldlenp, newp, newlen);
        default:
                if (name[0] < ICMPV6CTL_MAXID)
                        return (sysctl_int_arr(icmpv6ctl_vars, name, namelen,
diff --git sys/netinet6/nd6.c sys/netinet6/nd6.c
index 1a0cffea012..34d51aba6db 100644
--- sys/netinet6/nd6.c
+++ sys/netinet6/nd6.c
@@ -1430,49 +1430,3 @@ nd6_need_cache(struct ifnet *ifp)
                return (0);
        }
 }
-
-/*
- * oldp - syscall arg, need copyout
- * newp - syscall arg, need copyin
- */
-/* XXXDEL? */
-int
-nd6_sysctl(int name, void *oldp, size_t *oldlenp, void *newp, size_t newlen)
-{
-       void *p;
-       size_t ol;
-       int error;
-
-       NET_ASSERT_LOCKED();
-
-       error = 0;
-
-       if (newp)
-               return EPERM;
-       if (oldp && !oldlenp)
-               return EINVAL;
-       ol = oldlenp ? *oldlenp : 0;
-
-       if (oldp) {
-               p = malloc(ol, M_TEMP, M_WAITOK | M_CANFAIL);
-               if (!p)
-                       return ENOMEM;
-       } else
-               p = NULL;
-       switch (name) {
-       case ICMPV6CTL_ND6_DRLIST:
-               error = ENOTSUP; /* XXXDEL? can we delete more? */
-               break;
-
-       case ICMPV6CTL_ND6_PRLIST:
-               error = ENOTSUP; /* XXXDEL? can we delete more? */
-               break;
-
-       default:
-               error = ENOPROTOOPT;
-               break;
-       }
-       free(p, M_TEMP, ol);
-
-       return (error);
-}
diff --git sys/netinet6/nd6.h sys/netinet6/nd6.h
index 660c681e333..8b482596ed4 100644
--- sys/netinet6/nd6.h
+++ sys/netinet6/nd6.h
@@ -68,14 +68,6 @@ struct in6_nbrinfo {
        int     state;          /* reachability state */
 };
 
-struct in6_defrouter {
-       struct  sockaddr_in6 rtaddr;
-       time_t  expire;
-       u_short rtlifetime;
-       u_short if_index;
-       u_char  flags;
-};
-
 struct prf_ra {
        u_int onlink : 1;
        u_int autonomous : 1;
@@ -83,25 +75,6 @@ struct prf_ra {
        u_int reserved : 5;
 };
 
-struct in6_prefix {
-       struct  sockaddr_in6 prefix;
-       struct  prf_ra raflags;
-       time_t  expire;
-       u_int32_t vltime;
-       u_int32_t pltime;
-       u_int32_t flags;
-       int     refcnt;
-       u_short if_index;
-       u_short advrtrs; /* number of advertisement routers */
-       u_char  prefixlen;
-       u_char  origin;
-#define PR_ORIG_RA     0
-#define PR_ORIG_RR     1
-#define PR_ORIG_STATIC 2
-#define PR_ORIG_KERNEL 3
-       /* struct sockaddr_in6 advrtr[] */
-};
-
 struct in6_ndireq {
        char ifname[IFNAMSIZ];
        struct nd_ifinfo ndi;
@@ -217,7 +190,6 @@ int nd6_ioctl(u_long, caddr_t, struct ifnet *);
 void nd6_cache_lladdr(struct ifnet *, struct in6_addr *, char *, int, int, 
int);
 int nd6_resolve(struct ifnet *, struct rtentry *, struct mbuf *,
         struct sockaddr *, u_char *);
-int nd6_sysctl(int, void *, size_t *, void *, size_t);
 int nd6_need_cache(struct ifnet *);
 
 void nd6_na_input(struct mbuf *, int, int);
diff --git usr.sbin/ndp/ndp.8 usr.sbin/ndp/ndp.8
index b880445596d..2d9ad39e7f6 100644
--- usr.sbin/ndp/ndp.8
+++ usr.sbin/ndp/ndp.8
@@ -36,9 +36,9 @@
 .Nd control/diagnose IPv6 Neighbor Discovery Protocol (NDP)
 .Sh SYNOPSIS
 .Nm ndp
-.Op Fl nrt
-.Op Fl a | c | p
-.Op Fl H | P | R
+.Op Fl nt
+.Op Fl a | c
+.Op Fl H
 .Op Fl A Ar wait
 .Op Fl d Ar hostname
 .Op Fl f Ar filename
@@ -154,14 +154,6 @@ unless the interface is configured for inet6 
autoconfiguration.
 .El
 .It Fl n
 Do not try to resolve numeric addresses to hostnames.
-.It Fl P
-Flush all the entries in the prefix list.
-.It Fl p
-Show the prefix list.
-.It Fl R
-Flush all the entries in the default router list.
-.It Fl r
-Show the default router list.
 .It Xo
 .Fl s Ar nodename ether_addr
 .Op Cm temp
diff --git usr.sbin/ndp/ndp.c usr.sbin/ndp/ndp.c
index cd3f8989ea4..e02d3bd1c31 100644
--- usr.sbin/ndp/ndp.c
+++ usr.sbin/ndp/ndp.c
@@ -135,10 +135,6 @@ void usage(void);
 int rtmsg(int);
 int rtget(struct sockaddr_in6 **, struct sockaddr_dl **);
 void ifinfo(char *, int, char **);
-void rtrlist(void);
-void plist(void);
-void pfx_flush(void);
-void rtr_flush(void);
 void harmonize_rtr(void);
 static char *sec2str(time_t);
 static void ts_print(const struct timeval *);
@@ -162,7 +158,7 @@ main(int argc, char *argv[])
        pid = getpid();
        thiszone = gmt2local(0);
        rdomain = getrtable();
-       while ((ch = getopt(argc, argv, "acd:f:i:nprstA:HPRV:")) != -1) {
+       while ((ch = getopt(argc, argv, "acd:f:i:nstA:HV:")) != -1) {
                switch (ch) {
                case 'a':
                case 'c':
@@ -170,7 +166,6 @@ main(int argc, char *argv[])
                case 'r':
                case 'H':
                case 'P':
-               case 'R':
                case 's':
                        if (mode) {
                                usage();
@@ -243,23 +238,9 @@ main(int argc, char *argv[])
                        usage();
                file(arg);
                break;
-       case 'p':
-               if (argc != 0) {
-                       usage();
-                       /*NOTREACHED*/
-               }
-               plist();
-               break;
        case 'i':
                ifinfo(arg, argc, argv);
                break;
-       case 'r':
-               if (argc != 0) {
-                       usage();
-                       /*NOTREACHED*/
-               }
-               rtrlist();
-               break;
        case 's':
                if (argc < 2 || argc > 4)
                        usage();
@@ -271,20 +252,6 @@ main(int argc, char *argv[])
                }
                harmonize_rtr();
                break;
-       case 'P':
-               if (argc != 0) {
-                       usage();
-                       /*NOTREACHED*/
-               }
-               pfx_flush();
-               break;
-       case 'R':
-               if (argc != 0) {
-                       usage();
-                       /*NOTREACHED*/
-               }
-               rtr_flush();
-               break;
        case 0:
                if (argc != 1) {
                        usage();
@@ -800,7 +767,7 @@ ndp_ether_aton(char *a, u_char *n)
 void
 usage(void)
 {
-       printf("usage: ndp [-nrt] [-a | -c | -p] [-H | -P | -R] ");
+       printf("usage: ndp [-nt] [-a | -c] [-H] ");
        printf("[-A wait] [-d hostname]\n");
        printf("\t[-f filename] [-i interface [flag ...]]\n");
        printf("\t[-s nodename ether_addr [temp] [proxy]] ");
@@ -990,203 +957,6 @@ ifinfo(char *ifname, int argc, char **argv)
        close(s);
 }
 
-#ifndef ND_RA_FLAG_RTPREF_MASK /* XXX: just for compilation on *BSD release */
-#define ND_RA_FLAG_RTPREF_MASK 0x18 /* 00011000 */
-#endif
-
-void
-rtrlist(void)
-{
-       int mib[] = { CTL_NET, PF_INET6, IPPROTO_ICMPV6, ICMPV6CTL_ND6_DRLIST };
-       char *buf;
-       struct in6_defrouter *p, *ep;
-       size_t l;
-       struct timeval now;
-
-       if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), NULL, &l, NULL, 0) < 0) {
-               err(1, "sysctl(ICMPV6CTL_ND6_DRLIST)");
-               /*NOTREACHED*/
-       }
-       if (l == 0)
-               return;
-       buf = malloc(l);
-       if (buf == NULL) {
-               err(1, "malloc");
-               /*NOTREACHED*/
-       }
-       if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), buf, &l, NULL, 0) < 0) {
-               err(1, "sysctl(ICMPV6CTL_ND6_DRLIST)");
-               /*NOTREACHED*/
-       }
-
-       ep = (struct in6_defrouter *)(buf + l);
-       for (p = (struct in6_defrouter *)buf; p < ep; p++) {
-               int rtpref;
-
-               if (getnameinfo((struct sockaddr *)&p->rtaddr,
-                   p->rtaddr.sin6_len, host_buf, sizeof(host_buf), NULL, 0,
-                   (nflag ? NI_NUMERICHOST : 0)) != 0)
-                       strlcpy(host_buf, "?", sizeof(host_buf));
-
-               printf("%s if=%s", host_buf,
-                   if_indextoname(p->if_index, ifix_buf));
-               printf(", flags=%s%s",
-                   p->flags & ND_RA_FLAG_MANAGED ? "M" : "",
-                   p->flags & ND_RA_FLAG_OTHER   ? "O" : "");
-               rtpref = ((p->flags & ND_RA_FLAG_RTPREF_MASK) >> 3) & 0xff;
-               printf(", pref=%s", rtpref_str[rtpref]);
-
-               gettimeofday(&now, 0);
-               if (p->expire == 0)
-                       printf(", expire=Never\n");
-               else
-                       printf(", expire=%s\n",
-                           sec2str(p->expire - now.tv_sec));
-       }
-       free(buf);
-}
-
-void
-plist(void)
-{
-       int mib[] = { CTL_NET, PF_INET6, IPPROTO_ICMPV6, ICMPV6CTL_ND6_PRLIST };
-       char *buf, *p, *ep;
-       struct in6_prefix pfx;
-       size_t l;
-       struct timeval now;
-       const int niflags = NI_NUMERICHOST;
-       int ninflags = nflag ? NI_NUMERICHOST : 0;
-       char namebuf[NI_MAXHOST];
-
-       if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), NULL, &l, NULL, 0) < 0) {
-               err(1, "sysctl(ICMPV6CTL_ND6_PRLIST)");
-               /*NOTREACHED*/
-       }
-       if (l == 0)
-               return;
-       buf = malloc(l);
-       if (buf == NULL) {
-               err(1, "malloc");
-               /*NOTREACHED*/
-       }
-       if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), buf, &l, NULL, 0) < 0) {
-               err(1, "sysctl(ICMPV6CTL_ND6_PRLIST)");
-               /*NOTREACHED*/
-       }
-
-       ep = buf + l;
-       for (p = buf; p < ep; ) {
-               memcpy(&pfx, p, sizeof(pfx));
-               p += sizeof(pfx);
-
-               if (getnameinfo((struct sockaddr *)&pfx.prefix,
-                   pfx.prefix.sin6_len, namebuf, sizeof(namebuf),
-                   NULL, 0, niflags) != 0)
-                       strlcpy(namebuf, "?", sizeof(namebuf));
-               printf("%s/%d if=%s\n", namebuf, pfx.prefixlen,
-                   if_indextoname(pfx.if_index, ifix_buf));
-
-               gettimeofday(&now, 0);
-               /*
-                * meaning of fields, especially flags, is very different
-                * by origin.  notify the difference to the users.
-                */
-               printf("flags=%s%s%s%s%s",
-                   pfx.raflags.onlink ? "L" : "",
-                   pfx.raflags.autonomous ? "A" : "",
-                   (pfx.flags & NDPRF_ONLINK) != 0 ? "O" : "",
-                   (pfx.flags & NDPRF_DETACHED) != 0 ? "D" : "",
-                   (pfx.flags & NDPRF_HOME) != 0 ? "H" : ""
-                   );
-               if (pfx.vltime == ND6_INFINITE_LIFETIME)
-                       printf(" vltime=infinity");
-               else
-                       printf(" vltime=%lu", (unsigned long)pfx.vltime);
-               if (pfx.pltime == ND6_INFINITE_LIFETIME)
-                       printf(", pltime=infinity");
-               else
-                       printf(", pltime=%lu", (unsigned long)pfx.pltime);
-               if (pfx.expire == 0)
-                       printf(", expire=Never");
-               else if (pfx.expire >= now.tv_sec)
-                       printf(", expire=%s",
-                           sec2str(pfx.expire - now.tv_sec));
-               else
-                       printf(", expired");
-               printf(", ref=%d", pfx.refcnt);
-               printf("\n");
-               /*
-                * "advertising router" list is meaningful only if the prefix
-                * information is from RA.
-                */
-               if (pfx.advrtrs) {
-                       int j;
-                       struct sockaddr_in6 sin6;
-
-                       printf("  advertised by\n");
-                       for (j = 0; j < pfx.advrtrs && p <= ep; j++) {
-                               struct in6_nbrinfo *nbi;
-
-                               memcpy(&sin6, p, sizeof(sin6));
-                               p += sizeof(sin6);
-
-                               if (getnameinfo((struct sockaddr *)&sin6,
-                                   sin6.sin6_len, namebuf, sizeof(namebuf),
-                                   NULL, 0, ninflags) != 0)
-                                       strlcpy(namebuf, "?", sizeof(namebuf));
-                               printf("    %s", namebuf);
-
-                               nbi = getnbrinfo(&sin6.sin6_addr,
-                                   pfx.if_index, 0);
-                               if (nbi) {
-                                       switch (nbi->state) {
-                                       case ND6_LLINFO_REACHABLE:
-                                       case ND6_LLINFO_STALE:
-                                       case ND6_LLINFO_DELAY:
-                                       case ND6_LLINFO_PROBE:
-                                               printf(" (reachable)\n");
-                                               break;
-                                       default:
-                                               printf(" (unreachable)\n");
-                                       }
-                               } else
-                                       printf(" (no neighbor state)\n");
-                       }
-               } else
-                       printf("  No advertising router\n");
-       }
-       free(buf);
-}
-
-void
-pfx_flush(void)
-{
-       char dummyif[IFNAMSIZ+8];
-       int s;
-
-       if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
-               err(1, "socket");
-       strlcpy(dummyif, "lo0", sizeof(dummyif)); /* dummy */
-       if (ioctl(s, SIOCSPFXFLUSH_IN6, (caddr_t)&dummyif) < 0)
-               err(1, "ioctl(SIOCSPFXFLUSH_IN6)");
-       close(s);
-}
-
-void
-rtr_flush(void)
-{
-       char dummyif[IFNAMSIZ+8];
-       int s;
-
-       if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
-               err(1, "socket");
-       strlcpy(dummyif, "lo0", sizeof(dummyif)); /* dummy */
-       if (ioctl(s, SIOCSRTRFLUSH_IN6, (caddr_t)&dummyif) < 0)
-               err(1, "ioctl(SIOCSRTRFLUSH_IN6)");
-
-       close(s);
-}
-
 void
 harmonize_rtr(void)
 {



-- 
I'm not entirely sure you are real.

Reply via email to