[Bug 264858] IPv6: 'route add' sets wrong netif in fib when iface has different fib

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 23 Jun 2022 19:52:47 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264858

            Bug ID: 264858
           Summary: IPv6: 'route add' sets wrong netif in fib when iface
                    has different fib
           Product: Base System
           Version: 13.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: pmc@citylink.dinoex.sub.org

When adding a route into a fib, it may get connected to lo0 instead of the
desired interface, and traffic does not work.

Example:
--------

# ifconfig tun6
tun6: flags=8010<POINTOPOINT,MULTICAST> metric 0 mtu 1371
        options=80000<LINKSTATE>
        groups: tun
        nd6 options=1<PERFORMNUD>
# setfib 4 netstat -rn6
Routing tables (fib: 4)

Internet6:
Destination                       Gateway                       Flags     Netif
Expire
::/96                             ::1                           UGRS        lo0
::1                               link#1                        UHS         lo0
::ffff:0.0.0.0/96                 ::1                           UGRS        lo0
fe80::/10                         ::1                           UGRS        lo0
ff02::/16                         ::1                           UGRS        lo0

# ifconfig tun6 inet6 fe80::1%tun6 prefixlen 124
# route -6 add -net fe80::1%tun6/124 -iface tun6 -fib 4
add net fe80::1%tun6/124: gateway tun6 fib 4
# route -6 add -net default fe80::2%tun6 -fib 4
add net default: gateway fe80::2%tun6 fib 4
# setfib 4 netstat -rn6
Routing tables (fib: 4)

Internet6:
Destination                       Gateway                       Flags     Netif
Expire
::/96                             ::1                           UGRS        lo0
default                           fe80::2%tun6                  UGS         lo0
<<
::1                               link#1                        UHS         lo0
::ffff:0.0.0.0/96                 ::1                           UGRS        lo0
fe80::/10                         ::1                           UGRS        lo0
fe80::%tun6/124                   link#4                        US         tun6
ff02::/16                         ::1                           UGRS        lo0


But then, when changing the interface itself to the fib, it suddenly works as
desired:

# route -6 delete -net default fe80::2%tun6 -fib 4
delete net default: gateway fe80::2%tun6 fib 4
# ifconfig tun6 inet fib 4
# route -6 add -net default fe80::2%tun6 -fib 4
add net default: gateway fe80::2%tun6 fib 4
# setfib 4 netstat -rn6
Routing tables (fib: 4)

Internet6:
Destination                       Gateway                       Flags     Netif
Expire
::/96                             ::1                           UGRS        lo0
default                           fe80::2%tun6                  UGS        tun6
<<
::1                               link#1                        UHS         lo0
::ffff:0.0.0.0/96                 ::1                           UGRS        lo0
fe80::/10                         ::1                           UGRS        lo0
fe80::%tun6/124                   link#4                        US         tun6
ff02::/16                         ::1                           UGRS        lo0


I don't think this is the correct behaviour, because the fib on the interface
should concern incoming traffic, while the route table concerns outgoing
traffic, and one might want this to be separate concerns.

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