summaryrefslogtreecommitdiffstats
path: root/sys/netinet6
diff options
context:
space:
mode:
authorsuz <suz@FreeBSD.org>2005-10-19 16:20:18 +0000
committersuz <suz@FreeBSD.org>2005-10-19 16:20:18 +0000
commit44730c0a961e4ab4139bcc86c76abc037cd7bcb5 (patch)
tree663e44c4f12eb64e88a7e6185862f81f4bb294f7 /sys/netinet6
parentfe91d8d38d25c016172341749416c4f164406cc7 (diff)
downloadFreeBSD-src-44730c0a961e4ab4139bcc86c76abc037cd7bcb5.zip
FreeBSD-src-44730c0a961e4ab4139bcc86c76abc037cd7bcb5.tar.gz
supported an ndp command suboption to disable IPv6 in the given interface
Obtained from: KAME Reviewd by: ume, gnn MFC after: 2 week
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/ip6_input.c6
-rw-r--r--sys/netinet6/nd6.c6
-rw-r--r--sys/netinet6/nd6.h4
3 files changed, 16 insertions, 0 deletions
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index 9c5ff4a..757b1d1 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -278,6 +278,12 @@ ip6_input(m)
#undef M2MMAX
}
+ /* drop the packet if IPv6 operation is disabled on the IF */
+ if ((ND_IFINFO(m->m_pkthdr.rcvif)->flags & ND6_IFF_IFDISABLED)) {
+ m_freem(m);
+ return;
+ }
+
in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_receive);
ip6stat.ip6s_total++;
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index ae3664f..93186a5 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1996,6 +1996,12 @@ again:
return (0);
sendpkt:
+ /* discard the packet if IPv6 operation is disabled on the interface */
+ if ((ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED)) {
+ error = ENETDOWN; /* better error? */
+ goto bad;
+ }
+
#ifdef IPSEC
/* clean ipsec history once it goes out of the node */
ipsec_delaux(m);
diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h
index 33d2416..760671c 100644
--- a/sys/netinet6/nd6.h
+++ b/sys/netinet6/nd6.h
@@ -88,6 +88,10 @@ struct nd_ifinfo {
#define ND6_IFF_PERFORMNUD 0x1
#define ND6_IFF_ACCEPT_RTADV 0x2
+#define ND6_IFF_PREFER_SOURCE 0x4 /* XXX: not related to ND. */
+#define ND6_IFF_IFDISABLED 0x8 /* IPv6 operation is disabled due to
+ * DAD failure. (XXX: not ND-specific)
+ */
#ifdef _KERNEL
#define ND_IFINFO(ifp) \
OpenPOWER on IntegriCloud