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)
Sun, Nov 3, 5:35 PM
Unknown Object (File)
Oct 19 2024, 7:25 AM
Unknown Object (File)
Sep 10 2024, 8:43 PM
Unknown Object (File)
Sep 8 2024, 11:40 PM
Unknown Object (File)
Sep 7 2024, 3:29 PM
Unknown Object (File)
Aug 28 2024, 1:18 AM
Unknown Object (File)
Aug 24 2024, 7:03 AM
Unknown Object (File)
Aug 17 2024, 8:53 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.