From a283298ce37cd720cace8565093671c4b3355623 Mon Sep 17 00:00:00 2001 From: Hiroki Sato Date: Sat, 12 Sep 2009 22:08:20 +0000 Subject: Improve flexibility of receiving Router Advertisement and automatic link-local address configuration: - Convert a sysctl net.inet6.ip6.accept_rtadv to one for the default value of a per-IF flag ND6_IFF_ACCEPT_RTADV, not a global knob. The default value of the sysctl is 0. - Add a new per-IF flag ND6_IFF_AUTO_LINKLOCAL and convert a sysctl net.inet6.ip6.auto_linklocal to one for its default value. The default value of the sysctl is 1. - Make ND6_IFF_IFDISABLED more robust. It can be used to disable IPv6 functionality of an interface now. - Receiving RA is allowed if ip6_forwarding==0 *and* ND6_IFF_ACCEPT_RTADV is set on that interface. The former condition will be revisited later to support a "host + router" box like IPv6 CPE router. The current behavior is compatible with the older releases of FreeBSD. - The ifconfig(8) now supports these ND6 flags as well as "nud", "prefer_source", and "disabled" in ndp(8). The ndp(8) now supports "auto_linklocal". Discussed with: bz and jinmei Reviewed by: bz MFC after: 3 days --- usr.sbin/ndp/ndp.8 | 26 +++++++++++++++++--------- usr.sbin/ndp/ndp.c | 7 +++++++ 2 files changed, 24 insertions(+), 9 deletions(-) (limited to 'usr.sbin/ndp') diff --git a/usr.sbin/ndp/ndp.8 b/usr.sbin/ndp/ndp.8 index 70f51560a6a6..76f558ca2439 100644 --- a/usr.sbin/ndp/ndp.8 +++ b/usr.sbin/ndp/ndp.8 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 17, 1998 +.Dd September 2, 2009 .Dt NDP 8 .Os .\" @@ -182,11 +182,16 @@ NUD is usually turned on by default. Specify whether or not to accept Router Advertisement messages received on the .Ar interface . -Note that the kernel does not accept Router Advertisement messages -unless the -.Li net.inet6.ip6.accept_rtadv -variable is non-0, even if the flag is on. -This flag is set to 1 by default. +This flag is set by +.Va net.inet6.ip6.accept_rtadv +sysctl variable. +.It Ic auto_linklocal +Specify whether or not to perform automatic link-local address configuration +on +.Ar interface . +This flag is set by +.Va net.inet6.ip6.auto_linklocal +sysctl variable. .It Ic prefer_source Prefer addresses on the .Ar interface @@ -204,9 +209,8 @@ 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. +If the auto_linklocal per-interface flag is set, automatic link-local +address configuration is performed again when this flag is cleared. .It Ic basereachable Ns Li = Ns Pq Ar number Specify the BaseReachbleTimer on the interface in millisecond. .It Ic retrans Ns Li = Ns Pq Ar number @@ -253,6 +257,10 @@ Most useful when used with The .Nm utility first appeared in the WIDE Hydrangea IPv6 protocol stack kit. +The +.Fl I Ar auto_linklocal +flag first appeared in +.Fx 8.0 . .\" .\" .Sh BUGS .\" (to be written) diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c index 17e439ce5844..b701ead622f8 100644 --- a/usr.sbin/ndp/ndp.c +++ b/usr.sbin/ndp/ndp.c @@ -1004,6 +1004,9 @@ ifinfo(ifname, argc, argv) #ifdef ND6_IFF_ACCEPT_RTADV SETFLAG("accept_rtadv", ND6_IFF_ACCEPT_RTADV); #endif +#ifdef ND6_IFF_AUTO_LINKLOCAL + SETFLAG("auto_linklocal", ND6_IFF_AUTO_LINKLOCAL); +#endif #ifdef ND6_IFF_PREFER_SOURCE SETFLAG("prefer_source", ND6_IFF_PREFER_SOURCE); #endif @@ -1076,6 +1079,10 @@ ifinfo(ifname, argc, argv) if ((ND.flags & ND6_IFF_ACCEPT_RTADV)) printf("accept_rtadv "); #endif +#ifdef ND6_IFF_AUTO_LINKLOCAL + if ((ND.flags & ND6_IFF_AUTO_LINKLOCAL)) + printf("auto_linklocal "); +#endif #ifdef ND6_IFF_PREFER_SOURCE if ((ND.flags & ND6_IFF_PREFER_SOURCE)) printf("prefer_source "); -- cgit v1.2.3