diff options
author | florian <florian@openbsd.org> | 2017-08-09 14:36:00 +0000 |
---|---|---|
committer | florian <florian@openbsd.org> | 2017-08-09 14:36:00 +0000 |
commit | 0e39def21543fc4a59a3f446fce1173c0ffbd7fc (patch) | |
tree | 554de369e083f98de5292d39f08510d64b3c77f9 | |
parent | accept_rtadv doesn't do anything since some time. (diff) | |
download | wireguard-openbsd-0e39def21543fc4a59a3f446fce1173c0ffbd7fc.tar.xz wireguard-openbsd-0e39def21543fc4a59a3f446fce1173c0ffbd7fc.zip |
Remove knob and always do neighbor unreachable detection.
-rw-r--r-- | sys/netinet6/nd6.c | 10 | ||||
-rw-r--r-- | sys/netinet6/nd6.h | 5 | ||||
-rw-r--r-- | usr.sbin/ndp/ndp.8 | 26 | ||||
-rw-r--r-- | usr.sbin/ndp/ndp.c | 57 |
4 files changed, 17 insertions, 81 deletions
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index f94b4a99ae4..3568f81856c 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.c,v 1.216 2017/08/09 14:35:02 florian Exp $ */ +/* $OpenBSD: nd6.c,v 1.217 2017/08/09 14:36:00 florian Exp $ */ /* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */ /* @@ -138,7 +138,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; } @@ -387,16 +386,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: @@ -1002,7 +998,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 a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h index d5089231e46..fa63806d040 100644 --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.h,v 1.71 2017/08/09 14:35:02 florian Exp $ */ +/* $OpenBSD: nd6.h,v 1.72 2017/08/09 14:36:00 florian Exp $ */ /* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */ /* @@ -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 a/usr.sbin/ndp/ndp.8 b/usr.sbin/ndp/ndp.8 index 46678536db6..d622e584ab5 100644 --- a/usr.sbin/ndp/ndp.8 +++ b/usr.sbin/ndp/ndp.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ndp.8,v 1.44 2017/08/09 14:35:02 florian Exp $ +.\" $OpenBSD: ndp.8,v 1.45 2017/08/09 14:36:00 florian Exp $ .\" $KAME: ndp.8,v 1.28 2002/07/17 08:46:33 itojun Exp $ .\" .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -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 a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c index 0081bb91ce7..582b284f52c 100644 --- a/usr.sbin/ndp/ndp.c +++ b/usr.sbin/ndp/ndp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ndp.c,v 1.84 2017/08/09 14:35:02 florian Exp $ */ +/* $OpenBSD: ndp.c,v 1.85 2017/08/09 14:36:00 florian Exp $ */ /* $KAME: ndp.c,v 1.101 2002/07/17 08:46:33 itojun Exp $ */ /* @@ -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); } |