As a bonus this reduces the ndp option parsing insanity.

OK?

diff --git sys/netinet6/nd6.c sys/netinet6/nd6.c
index 7fd647c115a..f4af6632b4b 100644
--- sys/netinet6/nd6.c
+++ sys/netinet6/nd6.c
@@ -139,7 +139,6 @@ nd6_ifattach(struct ifnet *ifp)
        nd->reachable = ND_COMPUTE_RTIME(nd->basereachable);
        nd->retrans = RETRANS_TIMER;
        /* per-interface IFXF_AUTOCONF6 needs to be set too to accept RAs */
-       nd->flags = ND6_IFF_PERFORMNUD;
 
        return nd;
 }
@@ -388,16 +387,13 @@ nd6_llinfo_timer(void *arg)
                break;
 
        case ND6_LLINFO_DELAY:
-               if (ndi && (ndi->flags & ND6_IFF_PERFORMNUD) != 0) {
+               if (ndi) {
                        /* We need NUD */
                        ln->ln_asked = 1;
                        ln->ln_state = ND6_LLINFO_PROBE;
                        nd6_llinfo_settimer(ln, ndi->retrans / 1000);
                        nd6_ns_output(ifp, &dst->sin6_addr,
                            &dst->sin6_addr, ln, 0);
-               } else {
-                       ln->ln_state = ND6_LLINFO_STALE; /* XXX */
-                       nd6_llinfo_settimer(ln, nd6_gctimer);
                }
                break;
        case ND6_LLINFO_PROBE:
@@ -971,7 +967,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
                ndi->ndi = *ND_IFINFO(ifp);
                break;
        case SIOCSIFINFO_FLAGS:
-               ND_IFINFO(ifp)->flags = ndi->ndi.flags;
+               error = ENOTSUP;
                break;
        case SIOCSNDFLUSH_IN6:  /* XXX: the ioctl name is confusing... */
                /* sync kernel routing table with the default router list */
diff --git sys/netinet6/nd6.h sys/netinet6/nd6.h
index a3b9746e73d..ddaaac3425c 100644
--- sys/netinet6/nd6.h
+++ sys/netinet6/nd6.h
@@ -47,13 +47,10 @@ struct nd_ifinfo {
        u_int32_t basereachable;        /* BaseReachableTime */
        u_int32_t reachable;            /* Reachable Time */
        u_int32_t retrans;              /* Retrans Timer */
-       u_int32_t flags;                /* Flags */
        int recalctm;                   /* BaseReacable re-calculation timer */
        u_int8_t initialized; /* Flag to see the entry is initialized */
 };
 
-#define ND6_IFF_PERFORMNUD     0x1
-
 struct in6_nbrinfo {
        char ifname[IFNAMSIZ];  /* if name, e.g. "en0" */
        struct in6_addr addr;   /* IPv6 address of the neighbor */
diff --git usr.sbin/ndp/ndp.8 usr.sbin/ndp/ndp.8
index a2e863fbb97..c2a27164fb6 100644
--- usr.sbin/ndp/ndp.8
+++ usr.sbin/ndp/ndp.8
@@ -40,7 +40,7 @@
 .Op Fl A Ar wait
 .Op Fl d Ar hostname
 .Op Fl f Ar filename
-.Op Fl i Ar interface Op Ar flag ...
+.Op Fl i Ar interface
 .Op Fl s Ar nodename ether_addr Oo Cm temp Oc Op Cm proxy
 .Op Fl V Ar rdomain
 .Op Ar hostname
@@ -119,28 +119,8 @@ to be inserted in the neighbor cache.
 See the
 .Fl s
 option for a description of the file format.
-.It Fl i Ar interface Op Ar flag ...
+.It Fl i Ar interface
 View ND information for the specified interface.
-If additional arguments are given,
-.Nm
-sets or clears the specified flags for the interface.
-Each flag should be separated by whitespace or tab characters.
-Possible flags are as follows.
-All of the flags can begin with the
-special character
-.Ql - ,
-which means the flag should be cleared.
-Note that
-.Fl -
-would be needed before
-.Fl foo
-in this case.
-.Bl -tag -width Ds
-.It Ic nud
-Turn on or off NUD (Neighbor Unreachability Detection) on the
-interface.
-NUD is usually turned on by default.
-.El
 .It Fl n
 Do not try to resolve numeric addresses to hostnames.
 .It Xo
diff --git usr.sbin/ndp/ndp.c usr.sbin/ndp/ndp.c
index 800385d7779..2163322e1d6 100644
--- usr.sbin/ndp/ndp.c
+++ usr.sbin/ndp/ndp.c
@@ -134,7 +134,7 @@ int ndp_ether_aton(char *, u_char *);
 void usage(void);
 int rtmsg(int);
 int rtget(struct sockaddr_in6 **, struct sockaddr_dl **);
-void ifinfo(char *, int, char **);
+void ifinfo(char *);
 void harmonize_rtr(void);
 static char *sec2str(time_t);
 static void ts_print(const struct timeval *);
@@ -238,7 +238,9 @@ main(int argc, char *argv[])
                file(arg);
                break;
        case 'i':
-               ifinfo(arg, argc, argv);
+               if (argc != 0)
+                       usage();
+               ifinfo(arg);
                break;
        case 's':
                if (argc < 2 || argc > 4)
@@ -761,7 +763,7 @@ usage(void)
 {
        printf("usage: ndp [-acnt] ");
        printf("[-A wait] [-d hostname] [-f filename]\n");
-       printf("\t[-i interface [flag ...]] ");
+       printf("\t[-i interface] ");
        printf("[-s nodename ether_addr [temp] [proxy]]\n");
        printf("\t[-V rdomain] [hostname]\n");
        exit(1);
@@ -881,11 +883,10 @@ rtget(struct sockaddr_in6 **sinp, struct sockaddr_dl 
**sdlp)
 }
 
 void
-ifinfo(char *ifname, int argc, char **argv)
+ifinfo(char *ifname)
 {
        struct in6_ndireq nd;
        int i, s;
-       u_int32_t newflags;
 
        if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
                err(1, "socket");
@@ -893,55 +894,17 @@ ifinfo(char *ifname, int argc, char **argv)
        }
        bzero(&nd, sizeof(nd));
        strlcpy(nd.ifname, ifname, sizeof(nd.ifname));
-       if (ioctl(s, SIOCGIFINFO_IN6, (caddr_t)&nd) < 0) {
+       if (ioctl(s, SIOCGIFINFO_IN6, (caddr_t)&nd) < 0)
                err(1, "ioctl(SIOCGIFINFO_IN6)");
-               /* NOTREACHED */
-       }
-       newflags = nd.ndi.flags;
-       for (i = 0; i < argc; i++) {
-               int clear = 0;
-               char *cp = argv[i];
-
-               if (*cp == '-') {
-                       clear = 1;
-                       cp++;
-               }
-
-#define SETFLAG(s, f) \
-       do {\
-               if (strcmp(cp, (s)) == 0) {\
-                       if (clear)\
-                               newflags &= ~(f);\
-                       else\
-                               newflags |= (f);\
-               }\
-       } while (0)
-               SETFLAG("nud", ND6_IFF_PERFORMNUD);
-
-               nd.ndi.flags = newflags;
-               if (ioctl(s, SIOCSIFINFO_FLAGS, (caddr_t)&nd) < 0) {
-                       err(1, "ioctl(SIOCSIFINFO_FLAGS)");
-                       /* NOTREACHED */
-               }
-#undef SETFLAG
-       }
 
-       if (!nd.ndi.initialized) {
+       if (!nd.ndi.initialized)
                errx(1, "%s: not initialized yet", ifname);
-               /* NOTREACHED */
-       }
 
        printf("basereachable=%ds%dms",
            nd.ndi.basereachable / 1000, nd.ndi.basereachable % 1000);
        printf(", reachable=%ds", nd.ndi.reachable);
-       printf(", retrans=%ds%dms", nd.ndi.retrans / 1000,
+       printf(", retrans=%ds%dms\n", nd.ndi.retrans / 1000,
            nd.ndi.retrans % 1000);
-       if (nd.ndi.flags) {
-               printf("\nFlags: ");
-               if ((nd.ndi.flags & ND6_IFF_PERFORMNUD))
-                       printf("nud");
-       }
-       putc('\n', stdout);
 
        close(s);
 }

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

Reply via email to