Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Dec 2016 02:53:01 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-net@FreeBSD.org
Subject:   [Bug 196361] Constrain IPv6 routes to each FIB (Consistent with IPv4 route behaviour)
Message-ID:  <bug-196361-2472-TUr3Iyd7ZF@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-196361-2472@https.bugs.freebsd.org/bugzilla/>
References:  <bug-196361-2472@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D196361

--- Comment #9 from jhujhiti@adjectivism.org ---
Created attachment 178192
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D178192&action=
=3Dedit
Respect net.add_addr_allfibs=3D0 for inet6 (revision 1)

I didn't forget about this! I implemented against 10.3 about a year ago and
finally found the time to port it to HEAD. This patch essentially makes IPv6
respect net.add_addr_allfibs the same way IPv4 does. This is my first patch
against base - any feedback is welcome.

The changes here are mostly straightforward: where we have an ifp, we can u=
se
its FIB, and where we've previously assumed the default FIB, we should cons=
ider
that local routes can exist outside of it now. A couple changes are more
noteworthy:

* Default router selection (defrouter_ functions) can select multiple route=
rs,
up to one per FIB. defrouter_select() now takes a FIB argument to simplify =
the
logic inside the function. It is up to the caller to determine if we should
re-select routers for all FIBs, by making multiple calls, or not.
* In icmp6_reflect(), there may be an edge case where source address select=
ion
fails to use the correct FIB if in6ifa_ifwithaddr() returns NULL. I don't f=
ully
understand the situations in which this can happen (or if it's possible at
all).
* rtinit() didn't use the interface's FIB for both AF_INET as well as AF_IN=
ET6
and I don't understand why. For all uses of the function in AF_INET context,
using the interface FIB seems correct to me, but previous in_addprefix() and
rip_ctlinput() seem a little strange.

Here's what this looks like when net.add_addr_allfibs is 0. em0 and epair0b
here are bridged together and there is a router advertising fd00::/64.

em0: flags=3D8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 =
mtu
1500
        options=3D42098<VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,VLAN_=
HWTSO>
        ether e0:cb:4e:00:5c:99
        inet6 fe80::e2cb:4eff:fe00:5c99%em0 prefixlen 64 scopeid 0x1=20
        inet6 fd00::e2cb:4eff:fe00:5c99 prefixlen 64 autoconf=20
        nd6 options=3D23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
epair0b: flags=3D8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu =
1500
        options=3D8<VLAN_MTU>
        ether 04:ef:30:02:88:af
        inet6 fe80::6ef:30ff:fe02:88af%epair0b prefixlen 64 scopeid 0x6=20
        inet6 fd00::6ef:30ff:fe02:88af prefixlen 64 autoconf=20
        nd6 options=3D23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
        media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>)
        status: active
        fib: 1
        groups: epair=20

% ndp -na
Neighbor                             Linklayer Address  Netif Expire    S F=
lags
fe80::ff:30ff:fe02:80d%epair0b       02:ff:30:02:08:0d epair0b 23h45m16s S R
fd00::6ef:30ff:fe02:88af             04:ef:30:02:88:af epair0b permanent R=
=20
fe80::6ef:30ff:fe02:88af%epair0b     04:ef:30:02:88:af epair0b permanent R=
=20
fe80::ff:30ff:fe02:80d%em0           02:ff:30:02:08:0d    em0 23h43m46s S R
fd00::e2cb:4eff:fe00:5c99            e0:cb:4e:00:5c:99    em0 permanent R=20
fe80::e2cb:4eff:fe00:5c99%em0        e0:cb:4e:00:5c:99    em0 permanent R

% ndp -np=20
fd00::/64 if=3Depair0b
flags=3DLAO vltime=3D600, pltime=3D300, expire=3D8m8s, ref=3D1
  advertised by
    fe80::ff:30ff:fe02:80d%epair0b (reachable)
fe80::%epair0b/64 if=3Depair0b
flags=3DLAO vltime=3Dinfinity, pltime=3Dinfinity, expire=3DNever, ref=3D0
  No advertising router
fd00::/64 if=3Dem0
flags=3DLAO vltime=3D600, pltime=3D300, expire=3D8m8s, ref=3D1
  advertised by
    fe80::ff:30ff:fe02:80d%em0 (reachable)
fe80::%em0/64 if=3Dem0
flags=3DLAO vltime=3Dinfinity, pltime=3Dinfinity, expire=3DNever, ref=3D0
  No advertising router
fe80::%lo0/64 if=3Dlo0
flags=3DLAO vltime=3Dinfinity, pltime=3Dinfinity, expire=3DNever, ref=3D0
  No advertising router

% netstat -rnf inet6 -F0
Routing tables

Internet6:
Destination                       Gateway                       Flags     N=
etif
Expire
::/96                             ::1                           UGRS       =
 lo0
default                           fe80::ff:30ff:fe02:80d%em0    UG         =
 em0
::1                               link#3                        UH         =
 lo0
::ffff:0.0.0.0/96                 ::1                           UGRS       =
 lo0
fd00::/64                         link#1                        U          =
 em0
fd00::e2cb:4eff:fe00:5c99         link#1                        UHS        =
 lo0
fe80::/10                         ::1                           UGRS       =
 lo0
fe80::%em0/64                     link#1                        U          =
 em0
fe80::e2cb:4eff:fe00:5c99%em0     link#1                        UHS        =
 lo0
fe80::%lo0/64                     link#3                        U          =
 lo0
fe80::1%lo0                       link#3                        UHS        =
 lo0
ff02::/16                         ::1                           UGRS       =
 lo0

% netstat -rnf inet6 -F1
Routing tables (fib: 1)

Internet6:
Destination                       Gateway                       Flags     N=
etif
Expire
::/96                             ::1                           UGRS       =
 lo0
default                           fe80::ff:30ff:fe02:80d%epair0b UG     epa=
ir0b
::1                               lo0                           UHS        =
 lo0
::ffff:0.0.0.0/96                 ::1                           UGRS       =
 lo0
fd00::/64                         link#6                        U       epa=
ir0b
fd00::6ef:30ff:fe02:88af          link#6                        UHS        =
 lo0
fe80::/10                         ::1                           UGRS       =
 lo0
fe80::%epair0b/64                 link#6                        U       epa=
ir0b
fe80::6ef:30ff:fe02:88af%epair0b  link#6                        UHS        =
 lo0
ff02::/16                         ::1                           UGRS       =
 lo0

% ifmcstat -f inet6
em0:
        inet6 fe80::e2cb:4eff:fe00:5c99%em0 scopeid 0x1
        mldv2 flags=3D2<USEALLOW> rv 2 qi 125 qri 10 uri 3
                group ff01::1%em0 scopeid 0x1 mode exclude
                        mcast-macaddr 33:33:00:00:00:01
                group ff02::2:c26b:b618%em0 scopeid 0x1 mode exclude
                        mcast-macaddr 33:33:c2:6b:b6:18
                group ff02::2:ffc2:6bb6%em0 scopeid 0x1 mode exclude
                        mcast-macaddr 33:33:ff:c2:6b:b6
                group ff02::1%em0 scopeid 0x1 mode exclude
                        mcast-macaddr 33:33:00:00:00:01
                group ff02::1:ff00:5c99%em0 scopeid 0x1 mode exclude
                        mcast-macaddr 33:33:ff:00:5c:99
lo0:
        inet6 fe80::1%lo0 scopeid 0x3
        mldv2 flags=3D2<USEALLOW> rv 2 qi 125 qri 10 uri 3
                group ff01::1%lo0 scopeid 0x3 mode exclude
                group ff02::2:c26b:b618%lo0 scopeid 0x3 mode exclude
                group ff02::2:ffc2:6bb6%lo0 scopeid 0x3 mode exclude
                group ff02::1%lo0 scopeid 0x3 mode exclude
                group ff02::1:ff00:1%lo0 scopeid 0x3 mode exclude
epair0b:
        inet6 fe80::6ef:30ff:fe02:88af%epair0b scopeid 0x6
        mldv2 flags=3D2<USEALLOW> rv 2 qi 125 qri 10 uri 3
                group ff01::1%epair0b scopeid 0x6 mode exclude
                        mcast-macaddr 33:33:00:00:00:01
                group ff02::2:c26b:b618%epair0b scopeid 0x6 mode exclude
                        mcast-macaddr 33:33:c2:6b:b6:18
                group ff02::2:ffc2:6bb6%epair0b scopeid 0x6 mode exclude
                        mcast-macaddr 33:33:ff:c2:6b:b6
                group ff02::1%epair0b scopeid 0x6 mode exclude
                        mcast-macaddr 33:33:00:00:00:01
                group ff02::1:ff02:88af%epair0b scopeid 0x6 mode exclude
                        mcast-macaddr 33:33:ff:02:88:af

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-196361-2472-TUr3Iyd7ZF>