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)
Mon, Apr 1, 1:14 PM
Unknown Object (File)
Mar 8 2024, 12:12 AM
Unknown Object (File)
Feb 15 2024, 7:06 AM
Unknown Object (File)
Jan 31 2024, 6:11 PM
Unknown Object (File)
Jan 21 2024, 3:21 AM
Unknown Object (File)
Jan 17 2024, 9:43 AM
Unknown Object (File)
Jan 15 2024, 5:35 AM
Unknown Object (File)
Dec 22 2023, 11:55 PM
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 ?