summaryrefslogtreecommitdiffstats
path: root/sys/netinet6
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 /sys/netinet6
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 'sys/netinet6')
-rw-r--r--sys/netinet6/in6.c1
-rw-r--r--sys/netinet6/in6_var.h1
-rw-r--r--sys/netinet6/nd6.c28
3 files changed, 30 insertions, 0 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 77124f5..53d2c2d 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -361,6 +361,7 @@ in6_control(so, cmd, data, ifp, td)
/* FALLTHROUGH */
case OSIOCGIFINFO_IN6:
case SIOCGIFINFO_IN6:
+ case SIOCSIFINFO_IN6:
case SIOCGDRLST_IN6:
case SIOCGPRLST_IN6:
case SIOCGNBRINFO_IN6:
diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h
index 148fdbd..6bf87b2 100644
--- a/sys/netinet6/in6_var.h
+++ b/sys/netinet6/in6_var.h
@@ -404,6 +404,7 @@ struct in6_rrenumreq {
#define OSIOCGIFINFO_IN6 _IOWR('i', 76, struct in6_ondireq)
#endif
#define SIOCGIFINFO_IN6 _IOWR('i', 108, struct in6_ndireq)
+#define SIOCSIFINFO_IN6 _IOWR('i', 109, struct in6_ndireq)
#define SIOCSNDFLUSH_IN6 _IOWR('i', 77, struct in6_ifreq)
#define SIOCGNBRINFO_IN6 _IOWR('i', 78, struct in6_nbrinfo)
#define SIOCSPFXFLUSH_IN6 _IOWR('i', 79, struct in6_ifreq)
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 46b1ea1..ae3664f 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1441,6 +1441,34 @@ nd6_ioctl(cmd, data, ifp)
ND = *ND_IFINFO(ifp);
ND.linkmtu = IN6_LINKMTU(ifp);
break;
+ case SIOCSIFINFO_IN6:
+ /*
+ * used to change host variables from userland.
+ * intented for a use on router to reflect RA configurations.
+ */
+ /* 0 means 'unspecified' */
+ if (ND.linkmtu != 0) {
+ if (ND.linkmtu < IPV6_MMTU ||
+ ND.linkmtu > IN6_LINKMTU(ifp)) {
+ error = EINVAL;
+ break;
+ }
+ ND_IFINFO(ifp)->linkmtu = ND.linkmtu;
+ }
+
+ if (ND.basereachable != 0) {
+ int obasereachable = ND_IFINFO(ifp)->basereachable;
+
+ ND_IFINFO(ifp)->basereachable = ND.basereachable;
+ if (ND.basereachable != obasereachable)
+ ND_IFINFO(ifp)->reachable =
+ ND_COMPUTE_RTIME(ND.basereachable);
+ }
+ if (ND.retrans != 0)
+ ND_IFINFO(ifp)->retrans = ND.retrans;
+ if (ND.chlim != 0)
+ ND_IFINFO(ifp)->chlim = ND.chlim;
+ /* FALLTHROUGH */
case SIOCSIFINFO_FLAGS:
ND_IFINFO(ifp)->flags = ND.flags;
break;
OpenPOWER on IntegriCloud