summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rtadvd
diff options
context:
space:
mode:
authorsuz <suz@FreeBSD.org>2005-10-19 15:05:42 +0000
committersuz <suz@FreeBSD.org>2005-10-19 15:05:42 +0000
commit7cb7aed97b0e1c3253828f94db5e8b65429fded3 (patch)
tree3dc9168e29ff177252961d6c77b2be13d7b389e2 /usr.sbin/rtadvd
parente0f0e9f59a385855edfc18a8090a03938fea36b2 (diff)
downloadFreeBSD-src-7cb7aed97b0e1c3253828f94db5e8b65429fded3.zip
FreeBSD-src-7cb7aed97b0e1c3253828f94db5e8b65429fded3.tar.gz
added an ioctl option in kernel so that ndp/rtadvd can change some NDP-related kernel variables based on their configurations (RFC2461 p.43 6.2.1 mandates this for IPv6 routers)
Obtained from: KAME Reviewd by: ume, gnn MFC after: 2 weeks
Diffstat (limited to 'usr.sbin/rtadvd')
-rw-r--r--usr.sbin/rtadvd/config.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/usr.sbin/rtadvd/config.c b/usr.sbin/rtadvd/config.c
index 09e4eac..e9e3b97 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;
OpenPOWER on IntegriCloud