Page MenuHomeFreeBSD

Fix failure to add an interface prefix route when route with the same prefix is already presented in the routing table.
ClosedPublic

Authored by melifaro on Nov 12 2024, 9:41 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jan 22, 8:17 PM
Unknown Object (File)
Thu, Jan 16, 3:13 PM
Unknown Object (File)
Tue, Jan 14, 12:27 AM
Unknown Object (File)
Sat, Jan 11, 12:28 PM
Unknown Object (File)
Sat, Dec 28, 11:31 PM
Unknown Object (File)
Sat, Dec 28, 7:22 AM
Unknown Object (File)
Dec 26 2024, 1:36 AM
Unknown Object (File)
Dec 26 2024, 12:03 AM

Diff Detail

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

Event Timeline

The reported test passes successfully:

# route add -net 192.0.2.0/24 -interface vtnet0
add net 192.0.2.0: gateway vtnet0
# ifconfig epair create
epair0a
# ifconfig epair0a inet 192.0.2.1/24
# route show 192.0.2.0/24
   route to: 192.0.2.0
destination: 192.0.2.0
       mask: 255.255.255.0
        fib: 0
  interface: epair0a
      flags: <UP,DONE,PINNED>
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0      1500         1         0

Thank you!

This revision is now accepted and ready to land.Nov 13 2024, 7:50 AM

Sigh, it looks like this commit broke the following test:
https://ci.freebsd.org/view/Test/job/FreeBSD-main-amd64-test/lastCompletedBuild/testReport/junit/sys.net.routing.test_routing_l3/py/TestIfOps__test_change_prefix_route_inet_/
To reproduce:

# create two interfaces
if1=$(ifconfig epair create)
if2=$(ifconfig epair create)
# assign IP addresses in the same subnet
ifconfig $if1 inet 192.0.2.1/24
ifconfig $if2 inet 192.0.2.2/24
# Verify that the route points to the first interface (fails, as $if2 was added last, it points to $if2)
netstat -r4n | grep 192.0.2.0/24
# Remove the first interface
ifconfig $if1 destroy
# Verify that the route points to the second interface (it also fails, even if we remove $if2, we will have no route)
netstat -r4n | grep 192.0.2.0/24

Sigh, it looks like this commit broke the following test:

# create two interfaces
if1=$(ifconfig epair create)
if2=$(ifconfig epair create)
# assign IP addresses in the same subnet
ifconfig $if1 inet 192.0.2.1/24
ifconfig $if2 inet 192.0.2.2/24
# Verify that the route points to the first interface (fails, as $if2 was added last, it points to $if2)
netstat -r4n | grep 192.0.2.0/24
IMHO, we need to fix this behaviour. 
First PINNED route should have priority and second attempt to add the same route on $if2 should fail with EEXIST.
But then the test will fail, because after address deletion from $if1 there will not be any PINNED routes.