supported an ndp command suboption to disable IPv6 in the given interface

Obtained from: KAME
Reviewd by: ume, gnn
MFC after: 2 week
This commit is contained in:
SUZUKI Shinsuke 2005-10-19 16:20:18 +00:00
parent 057c4aff27
commit 5b27b04579
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=151474
5 changed files with 34 additions and 0 deletions

View File

@ -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++;

View File

@ -1996,6 +1996,12 @@ nd6_output(ifp, origifp, m0, dst, rt0)
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);

View File

@ -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) \

View File

@ -198,6 +198,19 @@ selection, see the
.Pa IMPLEMENTATION
file supplied with the KAME kit.
.It Xo
.Ic disabled
.Xc
Disable IPv6 operation on the interface.
When disabled, the interface discards any IPv6 packets
received on or being sent to the interface.
In the sending case, an error of ENETDOWN will be returned to the
application.
This flag is typically set automatically in the kernel as a result of
a certain failure of Duplicate Address Detection.
While the flag can be set or cleared by hand with the
.Nm
command, it is not generally advisable to modify this flag manually.
.It Xo
.Ic basereachable=(number)
.Xc
Specify the BaseReachbleTimer on the interface in millisecond.

View File

@ -989,6 +989,7 @@ ifinfo(ifname, argc, argv)
} \
} while (0)
SETFLAG("disabled", ND6_IFF_IFDISABLED);
SETFLAG("nud", ND6_IFF_PERFORMNUD);
#ifdef ND6_IFF_ACCEPT_RTADV
SETFLAG("accept_rtadv", ND6_IFF_ACCEPT_RTADV);
@ -1055,6 +1056,10 @@ ifinfo(ifname, argc, argv)
#endif
if (ND.flags) {
printf("\nFlags: ");
#ifdef ND6_IFF_IFDISABLED
if ((ND.flags & ND6_IFF_IFDISABLED))
printf("disabled ");
#endif
if ((ND.flags & ND6_IFF_PERFORMNUD))
printf("nud ");
#ifdef ND6_IFF_ACCEPT_RTADV