Page MenuHomeFreeBSD

Fix source address selection on unbound sockets with multiple fibs.
ClosedPublic

Authored by asomers on Sep 12 2014, 9:11 PM.
Tags
None
Referenced Files
Unknown Object (File)
May 2 2024, 11:08 AM
Unknown Object (File)
May 2 2024, 11:07 AM
Unknown Object (File)
May 2 2024, 9:42 AM
Unknown Object (File)
Jan 31 2024, 12:11 AM
Unknown Object (File)
Dec 20 2023, 12:06 AM
Unknown Object (File)
Nov 30 2023, 7:16 AM
Unknown Object (File)
Nov 6 2023, 7:27 PM
Unknown Object (File)
Aug 23 2023, 5:17 PM
Subscribers

Details

Reviewers
melifaro
hrs
bz
Group Reviewers
network
Summary

Fix source address selection on unbound sockets in the presence of multiple
fibs. Use the mbuf's or the socket's fib instead of RT_ALL_FIBS. Fixes PR

  1. Also fixes netperf's UDP_STREAM test on a nondefault fib.

sys/netinet/ip_output.c
In ip_output, lookup the source address using the mbuf's fib instead
of RT_ALL_FIBS.

sys/netinet/in_pcb.c
in in_pcbladdr, lookup the source address using the socket's fib,
because we don't seem to have the mbuf fib. They should be the
same, though.

tests/sys/net/fibs_test.sh
Clear the expected failure on udp_dontroute.

Test Plan

sys/net/fibs_test:udp_dontroute

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

asomers retitled this revision from to Fix source address selection on unbound sockets with multiple fibs..
asomers updated this object.
asomers edited the test plan for this revision. (Show Details)
asomers added reviewers: network, melifaro.
hrs added a reviewer: hrs.
hrs added a subscriber: hrs.

This patch looks good to me.

This revision is now accepted and ready to land.Sep 13 2014, 6:51 AM
melifaro edited edge metadata.

Looks good

bz added a reviewer: bz.
bz added a subscriber: bz.

I think I'd go ahead; I left the comment for the one ip_output.c case just in case we'll find other problems in the future.

sys/netinet/ip_output.c
256

I am not actually sure if these two instances in this case are correct. I wonder if in this case we should get the FIB from the interface? IP_ROUTETOIF is meant to bypass the routing table(s).

sys/netinet/ip_output.c
256

I think the mbuf fib is correct. We certainly can't use the interface fib, because at this point we don't yet know which interface to use. Furthermore, despite its description IP_ROUTETOIF can't mean to completely bypass the routing tables; we need the routing tables to do ifa_ifwithdstaddr and ifa_ifwithnet. IP_ROUTETOIF really just means to send the packet to a locally connected network instead of forwarding it through a router. Given that, our only real choice is whether to use the mbuf fib or RT_ALL_FIBS. If the system has multiple interfaces on the same network but with different fibs, then the mbuf fib (or the process fib) is the only way that the application has to request which interface to use. So I think that the mbuf fib is the best choice.