diff options
| author | SUZUKI Shinsuke <suz@FreeBSD.org> | 2005-10-19 15:05:42 +0000 |
|---|---|---|
| committer | SUZUKI Shinsuke <suz@FreeBSD.org> | 2005-10-19 15:05:42 +0000 |
| commit | b9204379a14bc57fac7a6d174af5b26d07b99c62 (patch) | |
| tree | 3dc9168e29ff177252961d6c77b2be13d7b389e2 /usr.sbin | |
| parent | 273ae68f43b0167479f0e8c7a18ceb3dd2339ebd (diff) | |
Notes
Diffstat (limited to 'usr.sbin')
| -rw-r--r-- | usr.sbin/ndp/ndp.8 | 29 | ||||
| -rw-r--r-- | usr.sbin/ndp/ndp.c | 33 | ||||
| -rw-r--r-- | usr.sbin/rtadvd/config.c | 30 |
3 files changed, 82 insertions, 10 deletions
diff --git a/usr.sbin/ndp/ndp.8 b/usr.sbin/ndp/ndp.8 index 5c31c41676d1..ea33646af2d7 100644 --- a/usr.sbin/ndp/ndp.8 +++ b/usr.sbin/ndp/ndp.8 @@ -63,7 +63,7 @@ .Op Fl nt .Fl i .Ar interface -.Op Ar flags ... +.Op Ar expressions ... .Nm .Op Fl nt .Fl I Op Ar interface | Li delete @@ -153,19 +153,20 @@ The will be used as the default. .It Fl I Li delete The current default interface will be deleted from the kernel. -.It Fl i Ar interface Op Ar flags ... +.It Fl i Ar interface Op Ar expressions ... View ND information for the specified interface. If additional arguments -.Ar flags +.Ar expressions are given, .Nm -sets or clears the specified flags for the interface. -Each flag should be separated by white spaces or tab characters. -Possible flags are as follows. -All of the flags can begin with the +sets or clears the flags or variables for the interface as specified in +the expression. +Each expression should be separated by white spaces or tab characters. +Possible expressions are as follows. +Some of the expressions can begin with the special character .Ql - , -which means the flag should be cleared. +which means the flag specified in the expression should be cleared. Note that you need .Fl - before @@ -196,6 +197,18 @@ For more details about the entire algorithm of source address selection, see the .Pa IMPLEMENTATION file supplied with the KAME kit. +.It Xo +.Ic basereachable=(number) +.Xc +Specify the BaseReachbleTimer on the interface in millisecond. +.It Xo +.Ic retrans=(number) +.Xc +Specify the RetransTimer on the interface in millisecond. +.It Xo +.Ic curhlim=(number) +.Xc +Specify the Cur Hop Limit on the interface. .El .It Fl n Do not try to resolve numeric addresses to hostnames. diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c index de3a80ac1dd9..31ed6773bbbd 100644 --- a/usr.sbin/ndp/ndp.c +++ b/usr.sbin/ndp/ndp.c @@ -965,6 +965,27 @@ ifinfo(ifname, argc, argv) newflags |= (f);\ }\ } while (0) +/* + * XXX: this macro is not 100% correct, in that it matches "nud" against + * "nudbogus". But we just let it go since this is minor. + */ +#define SETVALUE(f, v) \ + do { \ + char *valptr; \ + unsigned long newval; \ + v = 0; /* unspecified */ \ + if (strncmp(cp, f, strlen(f)) == 0) { \ + valptr = strchr(cp, '='); \ + if (valptr == NULL) \ + err(1, "syntax error in %s field", (f)); \ + errno = 0; \ + newval = strtoul(++valptr, NULL, 0); \ + if (errno) \ + err(1, "syntax error in %s's value", (f)); \ + v = newval; \ + } \ + } while (0) + SETFLAG("nud", ND6_IFF_PERFORMNUD); #ifdef ND6_IFF_ACCEPT_RTADV SETFLAG("accept_rtadv", ND6_IFF_ACCEPT_RTADV); @@ -972,13 +993,17 @@ ifinfo(ifname, argc, argv) #ifdef ND6_IFF_PREFER_SOURCE SETFLAG("prefer_source", ND6_IFF_PREFER_SOURCE); #endif + SETVALUE("basereachable", ND.basereachable); + SETVALUE("retrans", ND.retrans); + SETVALUE("curhlim", ND.chlim); ND.flags = newflags; - if (ioctl(s, SIOCSIFINFO_FLAGS, (caddr_t)&nd) < 0) { - err(1, "ioctl(SIOCSIFINFO_FLAGS)"); + if (ioctl(s, SIOCSIFINFO_IN6, (caddr_t)&nd) < 0) { + err(1, "ioctl(SIOCSIFINFO_IN6)"); /* NOTREACHED */ } #undef SETFLAG +#undef SETVALUE } if (!ND.initialized) { @@ -986,6 +1011,10 @@ ifinfo(ifname, argc, argv) /* NOTREACHED */ } + if (ioctl(s, SIOCGIFINFO_IN6, (caddr_t)&nd) < 0) { + err(1, "ioctl(SIOCGIFINFO_IN6)"); + /* NOTREACHED */ + } printf("linkmtu=%d", ND.linkmtu); printf(", maxmtu=%d", ND.maxmtu); printf(", curhlim=%d", ND.chlim); diff --git a/usr.sbin/rtadvd/config.c b/usr.sbin/rtadvd/config.c index 09e4eac659b5..e9e3b97246c9 100644 --- a/usr.sbin/rtadvd/config.c +++ b/usr.sbin/rtadvd/config.c @@ -46,6 +46,7 @@ #include <netinet/ip6.h> #include <netinet6/ip6_var.h> #include <netinet/icmp6.h> +#include <netinet6/nd6.h> #include <arpa/inet.h> @@ -407,6 +408,35 @@ getconfig(intface) exit(1); } +#ifdef SIOCSIFINFO_IN6 + { + struct in6_ndireq ndi; + int s; + + if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { + syslog(LOG_ERR, "<%s> socket: %s", __func__, + strerror(errno)); + exit(1); + } + memset(&ndi, 0, sizeof(ndi)); + strncpy(ndi.ifname, intface, IFNAMSIZ); + if (ioctl(s, SIOCGIFINFO_IN6, (caddr_t)&ndi) < 0) { + syslog(LOG_INFO, "<%s> ioctl:SIOCGIFINFO_IN6 at %s: %s", + __func__, intface, strerror(errno)); + } + + /* reflect the RA info to the host variables in kernel */ + ndi.ndi.chlim = tmp->hoplimit; + ndi.ndi.retrans = tmp->retranstimer; + ndi.ndi.basereachable = tmp->reachabletime; + if (ioctl(s, SIOCSIFINFO_IN6, (caddr_t)&ndi) < 0) { + syslog(LOG_INFO, "<%s> ioctl:SIOCSIFINFO_IN6 at %s: %s", + __func__, intface, strerror(errno)); + } + close(s); + } +#endif + /* route information */ #ifdef ROUTEINFO tmp->routes = 0; |
