summaryrefslogtreecommitdiffstats
path: root/sys/net/if_var.h
diff options
context:
space:
mode:
authorasomers <asomers@FreeBSD.org>2014-04-24 23:56:56 +0000
committerasomers <asomers@FreeBSD.org>2014-04-24 23:56:56 +0000
commitf8a34b6f4917582dfd787f47a09088f66e0ac509 (patch)
tree0064882c540e74bd3ff2493c7043a3d32284f2c3 /sys/net/if_var.h
parent520525b9030603bd0c155c88b72b14989c525a78 (diff)
downloadFreeBSD-src-f8a34b6f4917582dfd787f47a09088f66e0ac509.zip
FreeBSD-src-f8a34b6f4917582dfd787f47a09088f66e0ac509.tar.gz
Fix subnet and default routes on different FIBs on the same subnet.
These two bugs are closely related. The root cause is that ifa_ifwithnet does not consider FIBs when searching for an interface address. sys/net/if_var.h sys/net/if.c Add a fib argument to ifa_ifwithnet and ifa_ifwithdstadddr. Those functions will only return an address whose interface fib equals the argument. sys/net/route.c Update calls to ifa_ifwithnet and ifa_ifwithdstaddr with fib arguments. sys/netinet/in.c Update in_addprefix to consider the interface fib when adding prefixes. This will prevent it from not adding a subnet route when one already exists on a different fib. sys/net/rtsock.c sys/netinet/in_pcb.c sys/netinet/ip_output.c sys/netinet/ip_options.c sys/netinet6/nd6.c Add RT_DEFAULT_FIB arguments to ifa_ifwithdstaddr and ifa_ifwithnet. In some cases it there wasn't a clear specific fib number to use. In others, I was unable to test those functions so I chose RT_DEFAULT_FIB to minimize divergence from current behavior. I will fix some of the latter changes along with PR kern/187553. tests/sys/netinet/fibs_test.sh tests/sys/netinet/udp_dontroute.c tests/sys/netinet/Makefile Revert r263738. The udp_dontroute test was right all along. However, bugs kern/187550 and kern/187553 cancelled each other out when it came to this test. Because of kern/187553, ifa_ifwithnet searched the default fib instead of the requested one, but because of kern/187550, there was an applicable subnet route on the default fib. The new test added in r263738 doesn't work right, however. I can verify with dtrace that ifa_ifwithnet returned the wrong address before I applied this commit, but route(8) miraculously found the correct interface to use anyway. I don't know how. Clear expected failure messages for kern/187550 and kern/187552. PR: kern/187550 PR: kern/187552 Reviewed by: melifaro MFC after: 3 weeks Sponsored by: Spectra Logic
Diffstat (limited to 'sys/net/if_var.h')
-rw-r--r--sys/net/if_var.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 1cdc0b3..c7d98a0 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -495,8 +495,8 @@ int ifa_switch_loopback_route(struct ifaddr *, struct sockaddr *, int fib);
struct ifaddr *ifa_ifwithaddr(struct sockaddr *);
int ifa_ifwithaddr_check(struct sockaddr *);
struct ifaddr *ifa_ifwithbroadaddr(struct sockaddr *);
-struct ifaddr *ifa_ifwithdstaddr(struct sockaddr *);
-struct ifaddr *ifa_ifwithnet(struct sockaddr *, int);
+struct ifaddr *ifa_ifwithdstaddr(struct sockaddr *, int);
+struct ifaddr *ifa_ifwithnet(struct sockaddr *, int, int);
struct ifaddr *ifa_ifwithroute(int, struct sockaddr *, struct sockaddr *);
struct ifaddr *ifa_ifwithroute_fib(int, struct sockaddr *, struct sockaddr *, u_int);
struct ifaddr *ifaof_ifpforaddr(struct sockaddr *, struct ifnet *);
OpenPOWER on IntegriCloud