summaryrefslogtreecommitdiff
path: root/sys/netinet6
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2003-08-05 14:57:11 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2003-08-05 14:57:11 +0000
commit07cf047d5a4f2f47cdaba2f1ef694c62818fdf16 (patch)
treef89aeb24f450191c1cafa51dd63b26028ebc0bd4 /sys/netinet6
parent5246b4ff88f177ed3e74bf882945e941828d7adc (diff)
Notes
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/nd6.c7
-rw-r--r--sys/netinet6/nd6.h1
-rw-r--r--sys/netinet6/nd6_rtr.c7
3 files changed, 14 insertions, 1 deletions
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index f2f09f4020e0..2a66bb674ca8 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -191,7 +191,12 @@ nd6_ifattach(ifp)
ND.reachable = ND_COMPUTE_RTIME(ND.basereachable);
ND.retrans = RETRANS_TIMER;
ND.receivedra = 0;
- ND.flags = ND6_IFF_PERFORMNUD;
+ /*
+ * Note that the default value of ip6_accept_rtadv is 0, which means
+ * we won't accept RAs by default even if we set ND6_IFF_ACCEPT_RTADV
+ * here.
+ */
+ ND.flags = (ND6_IFF_PERFORMNUD | ND6_IFF_ACCEPT_RTADV);
nd6_setmtu(ifp);
#undef ND
}
diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h
index c8b531a7ae44..397a505f2453 100644
--- a/sys/netinet6/nd6.h
+++ b/sys/netinet6/nd6.h
@@ -87,6 +87,7 @@ struct nd_ifinfo {
};
#define ND6_IFF_PERFORMNUD 0x1
+#define ND6_IFF_ACCEPT_RTADV 0x2
struct in6_nbrinfo {
char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index 651a14d0ff89..7714969d4f95 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -217,8 +217,15 @@ nd6_ra_input(m, off, icmp6len)
union nd_opts ndopts;
struct nd_defrouter *dr;
+ /*
+ * We only accept RAs only when
+ * the system-wide variable allows the acceptance, and
+ * per-interface variable allows RAs on the receiving interface.
+ */
if (ip6_accept_rtadv == 0)
goto freeit;
+ if (!(ndi->flags & ND6_IFF_ACCEPT_RTADV))
+ goto freeit;
if (ip6->ip6_hlim != 255) {
nd6log((LOG_ERR,