svn commit: r272791 - in stable/9: sbin/ifconfig sys/netinet6 usr.bin/netstat usr.sbin/ndp
Andrey V. Elsukov
ae at FreeBSD.org
Thu Oct 9 03:07:16 UTC 2014
Author: ae
Date: Thu Oct 9 03:07:13 2014
New Revision: 272791
URL: https://svnweb.freebsd.org/changeset/base/272791
Log:
MFC r238273 (by hrs):
Remove "prefer_source" address selection option. FreeBSD has had an
implementation of RFC 3484 for this purpose for a long time and "prefer_source"
was never implemented actually. ND6_IFF_PREFER_SOURCE macro is left intact.
MFC r271307:
Add the ability to set `prefer_source' flag to an IPv6 address.
It affects the IPv6 source address selection algorithm (RFC 6724)
and allows override the last rule ("longest matching prefix") for
choosing among equivalent addresses. The address with `prefer_source'
will be preferred source address.
Modified:
stable/9/sbin/ifconfig/af_inet6.c
stable/9/sbin/ifconfig/ifconfig.8
stable/9/sys/netinet6/in6_src.c
stable/9/sys/netinet6/in6_var.h
stable/9/sys/netinet6/nd6.h
stable/9/usr.bin/netstat/inet6.c
stable/9/usr.sbin/ndp/ndp.8
stable/9/usr.sbin/ndp/ndp.c
Directory Properties:
stable/9/sbin/ifconfig/ (props changed)
stable/9/sys/ (props changed)
stable/9/usr.bin/netstat/ (props changed)
stable/9/usr.sbin/ndp/ (props changed)
Modified: stable/9/sbin/ifconfig/af_inet6.c
==============================================================================
--- stable/9/sbin/ifconfig/af_inet6.c Thu Oct 9 02:49:33 2014 (r272790)
+++ stable/9/sbin/ifconfig/af_inet6.c Thu Oct 9 03:07:13 2014 (r272791)
@@ -287,6 +287,8 @@ in6_status(int s __unused, const struct
printf("autoconf ");
if ((flags6 & IN6_IFF_TEMPORARY) != 0)
printf("temporary ");
+ if ((flags6 & IN6_IFF_PREFER_SOURCE) != 0)
+ printf("prefer_source ");
if (scopeid)
printf("scopeid 0x%x ", scopeid);
@@ -497,6 +499,8 @@ static struct cmd inet6_cmds[] = {
DEF_CMD("-deprecated", -IN6_IFF_DEPRECATED, setip6flags),
DEF_CMD("autoconf", IN6_IFF_AUTOCONF, setip6flags),
DEF_CMD("-autoconf", -IN6_IFF_AUTOCONF, setip6flags),
+ DEF_CMD("prefer_source",IN6_IFF_PREFER_SOURCE, setip6flags),
+ DEF_CMD("-prefer_source",-IN6_IFF_PREFER_SOURCE,setip6flags),
DEF_CMD("accept_rtadv", ND6_IFF_ACCEPT_RTADV, setnd6flags),
DEF_CMD("-accept_rtadv",-ND6_IFF_ACCEPT_RTADV, setnd6flags),
DEF_CMD("no_radr", ND6_IFF_NO_RADR, setnd6flags),
@@ -507,8 +511,6 @@ static struct cmd inet6_cmds[] = {
DEF_CMD("-ifdisabled", -ND6_IFF_IFDISABLED, setnd6flags),
DEF_CMD("nud", ND6_IFF_PERFORMNUD, setnd6flags),
DEF_CMD("-nud", -ND6_IFF_PERFORMNUD, setnd6flags),
- DEF_CMD("prefer_source",ND6_IFF_PREFER_SOURCE, setnd6flags),
- DEF_CMD("-prefer_source",-ND6_IFF_PREFER_SOURCE,setnd6flags),
DEF_CMD("auto_linklocal",ND6_IFF_AUTO_LINKLOCAL,setnd6flags),
DEF_CMD("-auto_linklocal",-ND6_IFF_AUTO_LINKLOCAL,setnd6flags),
DEF_CMD("no_prefer_iface",ND6_IFF_NO_PREFER_IFACE,setnd6flags),
Modified: stable/9/sbin/ifconfig/ifconfig.8
==============================================================================
--- stable/9/sbin/ifconfig/ifconfig.8 Thu Oct 9 02:49:33 2014 (r272790)
+++ stable/9/sbin/ifconfig/ifconfig.8 Thu Oct 9 03:07:13 2014 (r272791)
@@ -28,7 +28,7 @@
.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
.\" $FreeBSD$
.\"
-.Dd January 10, 2013
+.Dd September 9, 2014
.Dt IFCONFIG 8
.Os
.Sh NAME
@@ -716,12 +716,6 @@ Set a flag to enable Neighbor Unreachabi
.It Cm -nud
Clear a flag
.Cm nud .
-.It Cm prefer_source
-Set a flag to prefer addresses on the interface as candidates of the
-source address for outgoing packets.
-.It Cm -prefer_source
-Clear a flag
-.Cm prefer_source .
.It Cm no_prefer_iface
Set a flag to not prefer address on the interface as candidates of the
source address for outgoing packets, even when the interface is
@@ -731,6 +725,19 @@ Clear a flag
.Cm no_prefer_iface .
.El
.Pp
+The following parameters are specific for IPv6 addresses.
+Note that the address family keyword
+.Dq Li inet6
+is needed for them:
+.Bl -tag -width indent
+.It Cm prefer_source
+Set a flag to prefer address as a candidate of the source address for
+outgoing packets.
+.It Cm -prefer_source
+Clear a flag
+.Cm prefer_source .
+.El
+.Pp
The following parameters are specific to cloning
IEEE 802.11 wireless interfaces with the
.Cm create
Modified: stable/9/sys/netinet6/in6_src.c
==============================================================================
--- stable/9/sys/netinet6/in6_src.c Thu Oct 9 02:49:33 2014 (r272790)
+++ stable/9/sys/netinet6/in6_src.c Thu Oct 9 03:07:13 2014 (r272791)
@@ -443,6 +443,16 @@ in6_selectsrc(struct sockaddr_in6 *dstso
REPLACE(8);
/*
+ * Rule 10: prefer address with `prefer_source' flag.
+ */
+ if ((ia_best->ia6_flags & IN6_IFF_PREFER_SOURCE) == 0 &&
+ (ia->ia6_flags & IN6_IFF_PREFER_SOURCE) != 0)
+ REPLACE(10);
+ if ((ia_best->ia6_flags & IN6_IFF_PREFER_SOURCE) != 0 &&
+ (ia->ia6_flags & IN6_IFF_PREFER_SOURCE) == 0)
+ NEXT(10);
+
+ /*
* Rule 14: Use longest matching prefix.
* Note: in the address selection draft, this rule is
* documented as "Rule 8". However, since it is also
Modified: stable/9/sys/netinet6/in6_var.h
==============================================================================
--- stable/9/sys/netinet6/in6_var.h Thu Oct 9 02:49:33 2014 (r272790)
+++ stable/9/sys/netinet6/in6_var.h Thu Oct 9 03:07:13 2014 (r272791)
@@ -473,6 +473,7 @@ struct in6_rrenumreq {
*/
#define IN6_IFF_AUTOCONF 0x40 /* autoconfigurable address. */
#define IN6_IFF_TEMPORARY 0x80 /* temporary (anonymous) address. */
+#define IN6_IFF_PREFER_SOURCE 0x0100 /* preferred address for SAS */
#define IN6_IFF_NOPFX 0x8000 /* skip kernel prefix management.
* XXX: this should be temporary.
*/
Modified: stable/9/sys/netinet6/nd6.h
==============================================================================
--- stable/9/sys/netinet6/nd6.h Thu Oct 9 02:49:33 2014 (r272790)
+++ stable/9/sys/netinet6/nd6.h Thu Oct 9 03:07:13 2014 (r272791)
@@ -79,7 +79,7 @@ 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_PREFER_SOURCE 0x4 /* Not used in FreeBSD. */
#define ND6_IFF_IFDISABLED 0x8 /* IPv6 operation is disabled due to
* DAD failure. (XXX: not ND-specific)
*/
Modified: stable/9/usr.bin/netstat/inet6.c
==============================================================================
--- stable/9/usr.bin/netstat/inet6.c Thu Oct 9 02:49:33 2014 (r272790)
+++ stable/9/usr.bin/netstat/inet6.c Thu Oct 9 03:07:13 2014 (r272791)
@@ -346,7 +346,7 @@ static char *srcrule_str[] = {
"public/temporary address",
"alive interface",
"preferred interface",
- "rule #10",
+ "preferred source",
"rule #11",
"rule #12",
"rule #13",
Modified: stable/9/usr.sbin/ndp/ndp.8
==============================================================================
--- stable/9/usr.sbin/ndp/ndp.8 Thu Oct 9 02:49:33 2014 (r272790)
+++ stable/9/usr.sbin/ndp/ndp.8 Thu Oct 9 03:07:13 2014 (r272791)
@@ -209,15 +209,6 @@ on
This flag is set by
.Va net.inet6.ip6.auto_linklocal
sysctl variable.
-.It Ic prefer_source
-Prefer addresses on the
-.Ar interface
-as candidates of the source address for outgoing packets.
-The default value of this flag is off.
-For more details about the entire algorithm of source address
-selection, see the
-.Pa IMPLEMENTATION
-file supplied with the KAME kit.
.It Ic no_prefer_iface
The address on the outgoing interface is preferred by source addess
selection rule.
Modified: stable/9/usr.sbin/ndp/ndp.c
==============================================================================
--- stable/9/usr.sbin/ndp/ndp.c Thu Oct 9 02:49:33 2014 (r272790)
+++ stable/9/usr.sbin/ndp/ndp.c Thu Oct 9 03:07:13 2014 (r272791)
@@ -1013,9 +1013,6 @@ ifinfo(ifname, argc, argv)
#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
#ifdef ND6_IFF_NO_PREFER_IFACE
SETFLAG("no_prefer_iface", ND6_IFF_NO_PREFER_IFACE);
#endif
@@ -1092,10 +1089,6 @@ ifinfo(ifname, argc, argv)
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 ");
-#endif
#ifdef ND6_IFF_NO_PREFER_IFACE
if ((ND.flags & ND6_IFF_NO_PREFER_IFACE))
printf("no_prefer_iface ");
More information about the svn-src-stable-9
mailing list