Page MenuHomeFreeBSD

routing: fix source address selection rules for IPv4 over IPv6.
ClosedPublic

Authored by melifaro on Sep 6 2021, 10:28 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 8, 5:50 PM
Unknown Object (File)
Thu, Nov 7, 8:19 AM
Unknown Object (File)
Oct 14 2024, 4:55 AM
Unknown Object (File)
Oct 3 2024, 10:59 PM
Unknown Object (File)
Oct 3 2024, 11:37 AM
Unknown Object (File)
Oct 1 2024, 12:57 PM
Unknown Object (File)
Oct 1 2024, 11:01 AM
Unknown Object (File)
Oct 1 2024, 5:57 AM
Subscribers

Details

Summary

Current logic always selects an IFA of the same family from the
outgoing interfaces. In IPv4 over IPv6 setup there can be just
single non-127.0.0.1 ifa, attach to an loopback address.

Create a separate rt_getifa_family() to handle entire ifa selection
for the IPv4 over IPv6.

Test Plan

Without the change:

22:29 [0] m@devel2 ifconfig
vtnet0: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=4c04bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,LRO,VLAN_HWTSO,LINKSTATE,TXCSUM_IPV6>
	ether 52:54:00:14:e3:19
	inet6 fe80::5054:ff:fe14:e319%vtnet0 prefixlen 64 scopeid 0x1
	inet6 2a01:4f8:13a:70c:ffff::8 prefixlen 96
	media: Ethernet autoselect (10Gbase-T <full-duplex>)
	status: active
	nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

22:30 [0] m@devel2 s route add default -inet6 2a01:4f8:13a:70c:ffff::1

22:30 [0] m@devel2 netstat -4rnW
Routing tables

Internet:
Destination        Gateway            Flags   Nhop#    Mtu      Netif Expire
default            2a01:4f8:13a:70c:ffff::1 UGS      3   1500     vtnet0
10.199.199.190     link#2             UH          2  16384        lo0
127.0.0.1          link#2             UH          1  16384        lo0
22:30 [0] m@devel2 netstat -4onW
Nexthop data

Internet:
Idx   Type         IFA                Gateway             Flags      Use Mtu         Netif     Addrif Refcnt Prepend
1       v4/resolve 127.0.0.1          lo0/resolve        H             0  16384        lo0               2
2       v4/resolve 10.199.199.190     lo0/resolve        H             0  16384        lo0               2
3            v4/gw 2a01:4f8:13a:70c:ffff::8 2a01:4f8:13a:70c:ffff::1 GS        0   1500     vtnet0               2
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

After the change:

22:35 [0] m@devel2 netstat -4rnW
Routing tables

Internet:
Destination        Gateway            Flags   Nhop#    Mtu      Netif Expire
default            2a01:4f8:13a:70c:ffff::1 UGS      3   1500     vtnet0
10.199.199.190     link#2             UH          2  16384        lo0
127.0.0.1          link#2             UH          1  16384        lo0
22:35 [0] m@devel2 netstat -4onW
Nexthop data

Internet:
Idx   Type         IFA                Gateway             Flags      Use Mtu         Netif     Addrif Refcnt Prepend
1       v4/resolve 127.0.0.1          lo0/resolve        H             0  16384        lo0               2
2       v4/resolve 10.199.199.190     lo0/resolve        H             0  16384        lo0               2
3            v4/gw 10.199.199.190     2a01:4f8:13a:70c:ffff::1 GS        0   1500     vtnet0               2
22:35 [0] m@devel2

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

melifaro added a reviewer: network.
melifaro added a reviewer: zlei.
This revision was not accepted when it landed; it landed in state Needs Review.Sep 7 2021, 9:44 PM
This revision was automatically updated to reflect the committed changes.

I'm still investing on this issue. As the following case

  1. IPv4 over IPv6 nexthops
  2. IPv4 over IPv4 linklocal nexthops

we can treat them as Unnumbered, and for routers there's https://datatracker.ietf.org/doc/html/rfc1812#section-2.2.7, claiming router-id should be used.

As for end hosts, I have not found any RFCs specifying it.

Any thoughts ? @melifaro

Hi,
I tested this patch with stable/13 in my home lab for about two weeks without any problems. Any progress will this be merge into stable/13 ?