summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2014-10-09 02:49:33 +0000
committerae <ae@FreeBSD.org>2014-10-09 02:49:33 +0000
commit142c06446733cb14eb874687d9867f69af201fba (patch)
treeff1ad08f4c6210380494738b7ccca66c8ac06526 /sbin
parent4742b8fd12181fb4ab76f445c6bf6e95c7598e0c (diff)
downloadFreeBSD-src-142c06446733cb14eb874687d9867f69af201fba.zip
FreeBSD-src-142c06446733cb14eb874687d9867f69af201fba.tar.gz
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.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ifconfig/af_inet6.c4
-rw-r--r--sbin/ifconfig/ifconfig.815
2 files changed, 18 insertions, 1 deletions
diff --git a/sbin/ifconfig/af_inet6.c b/sbin/ifconfig/af_inet6.c
index d2e65e4..0f8688a 100644
--- a/sbin/ifconfig/af_inet6.c
+++ b/sbin/ifconfig/af_inet6.c
@@ -254,6 +254,8 @@ in6_status(int s __unused, const struct ifaddrs *ifa)
printf("autoconf ");
if ((flags6 & IN6_IFF_TEMPORARY) != 0)
printf("temporary ");
+ if ((flags6 & IN6_IFF_PREFER_SOURCE) != 0)
+ printf("prefer_source ");
if (((struct sockaddr_in6 *)(ifa->ifa_addr))->sin6_scope_id)
printf("scopeid 0x%x ",
@@ -465,6 +467,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),
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
index 83065f1..278142a 100644
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -28,7 +28,7 @@
.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
.\" $FreeBSD$
.\"
-.Dd October 21, 2013
+.Dd September 9, 2014
.Dt IFCONFIG 8
.Os
.Sh NAME
@@ -725,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
OpenPOWER on IntegriCloud