[Midnightbsd-cvs] src [8634] trunk: it stops treating the address on the interface as pspecial by source address selection rule even when the interface is outgoing interface.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Sep 25 14:12:51 EDT 2016
Revision: 8634
http://svnweb.midnightbsd.org/src/?rev=8634
Author: laffer1
Date: 2016-09-25 14:12:51 -0400 (Sun, 25 Sep 2016)
Log Message:
-----------
it stops treating the address on the interface as pspecial by source address selection rule even when the interface is outgoing interface.
Modified Paths:
--------------
trunk/sbin/ifconfig/af_inet6.c
trunk/sbin/ifconfig/af_nd6.c
trunk/sbin/ifconfig/ifconfig.8
trunk/sys/netinet6/in6_src.c
trunk/sys/netinet6/nd6.h
trunk/usr.sbin/ndp/ndp.8
trunk/usr.sbin/ndp/ndp.c
Modified: trunk/sbin/ifconfig/af_inet6.c
===================================================================
--- trunk/sbin/ifconfig/af_inet6.c 2016-09-25 18:11:10 UTC (rev 8633)
+++ trunk/sbin/ifconfig/af_inet6.c 2016-09-25 18:12:51 UTC (rev 8634)
@@ -472,6 +472,8 @@
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),
+ DEF_CMD("-no_prefer_iface",-ND6_IFF_NO_PREFER_IFACE,setnd6flags),
DEF_CMD_ARG("pltime", setip6pltime),
DEF_CMD_ARG("vltime", setip6vltime),
DEF_CMD("eui64", 0, setip6eui64),
Modified: trunk/sbin/ifconfig/af_nd6.c
===================================================================
--- trunk/sbin/ifconfig/af_nd6.c 2016-09-25 18:11:10 UTC (rev 8633)
+++ trunk/sbin/ifconfig/af_nd6.c 2016-09-25 18:12:51 UTC (rev 8634)
@@ -58,7 +58,7 @@
#define MAX_SYSCTL_TRY 5
#define ND6BITS "\020\001PERFORMNUD\002ACCEPT_RTADV\003PREFER_SOURCE" \
"\004IFDISABLED\005DONT_SET_IFROUTE\006AUTO_LINKLOCAL" \
- "\007NO_RADR\020DEFAULTIF"
+ "\007NO_RADR\010NO_PREFER_IFACE\020DEFAULTIF"
static int isnd6defif(int);
void setnd6flags(const char *, int, int, const struct afswtch *);
Modified: trunk/sbin/ifconfig/ifconfig.8
===================================================================
--- trunk/sbin/ifconfig/ifconfig.8 2016-09-25 18:11:10 UTC (rev 8633)
+++ trunk/sbin/ifconfig/ifconfig.8 2016-09-25 18:12:51 UTC (rev 8634)
@@ -28,7 +28,7 @@
.\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94
.\" $MidnightBSD$
.\"
-.Dd November 7, 2012
+.Dd January 10, 2013
.Dt IFCONFIG 8
.Os
.Sh NAME
@@ -722,6 +722,13 @@
.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
+outgoing interface.
+.It Cm -no_prefer_iface
+Clear a flag
+.Cm no_prefer_iface .
.El
.Pp
The following parameters are specific to cloning
Modified: trunk/sys/netinet6/in6_src.c
===================================================================
--- trunk/sys/netinet6/in6_src.c 2016-09-25 18:11:10 UTC (rev 8633)
+++ trunk/sys/netinet6/in6_src.c 2016-09-25 18:12:51 UTC (rev 8634)
@@ -383,10 +383,12 @@
*/
/* Rule 5: Prefer outgoing interface */
- if (ia_best->ia_ifp == ifp && ia->ia_ifp != ifp)
- NEXT(5);
- if (ia_best->ia_ifp != ifp && ia->ia_ifp == ifp)
- REPLACE(5);
+ if (!(ND_IFINFO(ifp)->flags & ND6_IFF_NO_PREFER_IFACE)) {
+ if (ia_best->ia_ifp == ifp && ia->ia_ifp != ifp)
+ NEXT(5);
+ if (ia_best->ia_ifp != ifp && ia->ia_ifp == ifp)
+ REPLACE(5);
+ }
/*
* Rule 6: Prefer matching label
Modified: trunk/sys/netinet6/nd6.h
===================================================================
--- trunk/sys/netinet6/nd6.h 2016-09-25 18:11:10 UTC (rev 8633)
+++ trunk/sys/netinet6/nd6.h 2016-09-25 18:12:51 UTC (rev 8634)
@@ -86,6 +86,7 @@
#define ND6_IFF_DONT_SET_IFROUTE 0x10
#define ND6_IFF_AUTO_LINKLOCAL 0x20
#define ND6_IFF_NO_RADR 0x40
+#define ND6_IFF_NO_PREFER_IFACE 0x80 /* XXX: not related to ND. */
#define ND6_CREATE LLE_CREATE
#define ND6_EXCLUSIVE LLE_EXCLUSIVE
Modified: trunk/usr.sbin/ndp/ndp.8
===================================================================
--- trunk/usr.sbin/ndp/ndp.8 2016-09-25 18:11:10 UTC (rev 8633)
+++ trunk/usr.sbin/ndp/ndp.8 2016-09-25 18:12:51 UTC (rev 8634)
@@ -29,7 +29,7 @@
.\"
.\" $MidnightBSD$
.\"
-.Dd September 2, 2009
+.Dd Jan 10, 2013
.Dt NDP 8
.Os
.\"
@@ -201,6 +201,15 @@
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.
+If this flag is set, stop treating the address on the
+.Ar interface
+as special even when the
+.Ar interface
+is outgoing interface.
+The default value of this flag is off.
.It Ic disabled
Disable IPv6 operation on the interface.
When disabled, the interface discards any IPv6 packets
Modified: trunk/usr.sbin/ndp/ndp.c
===================================================================
--- trunk/usr.sbin/ndp/ndp.c 2016-09-25 18:11:10 UTC (rev 8633)
+++ trunk/usr.sbin/ndp/ndp.c 2016-09-25 18:12:51 UTC (rev 8634)
@@ -1011,6 +1011,9 @@
#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
SETVALUE("basereachable", ND.basereachable);
SETVALUE("retrans", ND.retrans);
SETVALUE("curhlim", ND.chlim);
@@ -1088,6 +1091,10 @@
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 ");
+#endif
}
putc('\n', stdout);
#undef ND
More information about the Midnightbsd-cvs
mailing list