Date: Fri, 6 Jun 2014 21:45:14 +0000 (UTC) From: Alan Somers <asomers@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r267193 - in stable/10: sys/net sys/netinet tests/sys/netinet Message-ID: <201406062145.s56LjEKQ073872@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: asomers Date: Fri Jun 6 21:45:14 2014 New Revision: 267193 URL: http://svnweb.freebsd.org/changeset/base/267193 Log: MFC r264887 Fix host and network routes for new interfaces when net.add_addr_allfibs=0 sys/net/route.c In rtinit1, use the interface fib instead of the process fib. The latter wasn't very useful because ifconfig(8) is usually invoked with the default process fib. Changing ifconfig(8) to use setfib(2) would be redundant, because it already sets the interface fib. tests/sys/netinet/fibs_test.sh Clear the expected ATF failure sys/net/if.c Pass the interface fib in calls to rtrequest1_fib and rtalloc1_fib sys/netinet/in.c sys/net/if_var.h Add a fibnum argument to ifa_switch_loopback_route, a subroutine of in_scrubprefix. Pass it the interface fib. Modified: stable/10/sys/net/if.c stable/10/sys/net/route.c stable/10/sys/netinet/in.c stable/10/tests/sys/netinet/fibs_test.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/if.c ============================================================================== --- stable/10/sys/net/if.c Fri Jun 6 21:39:16 2014 (r267192) +++ stable/10/sys/net/if.c Fri Jun 6 21:45:14 2014 (r267193) @@ -1458,7 +1458,7 @@ ifa_add_loopback_route(struct ifaddr *if info.rti_flags = ifa->ifa_flags | RTF_HOST | RTF_STATIC; info.rti_info[RTAX_DST] = ia; info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; - error = rtrequest1_fib(RTM_ADD, &info, &rt, 0); + error = rtrequest1_fib(RTM_ADD, &info, &rt, ifa->ifa_ifp->if_fib); if (error == 0 && rt != NULL) { RT_LOCK(rt); @@ -1490,7 +1490,7 @@ ifa_del_loopback_route(struct ifaddr *if info.rti_flags = ifa->ifa_flags | RTF_HOST | RTF_STATIC; info.rti_info[RTAX_DST] = ia; info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; - error = rtrequest1_fib(RTM_DELETE, &info, NULL, 0); + error = rtrequest1_fib(RTM_DELETE, &info, NULL, ifa->ifa_ifp->if_fib); if (error != 0) log(LOG_DEBUG, "%s: deletion failed: %u\n", __func__, error); Modified: stable/10/sys/net/route.c ============================================================================== --- stable/10/sys/net/route.c Fri Jun 6 21:39:16 2014 (r267192) +++ stable/10/sys/net/route.c Fri Jun 6 21:45:14 2014 (r267193) @@ -1543,7 +1543,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int } if (fibnum == RT_ALL_FIBS) { if (rt_add_addr_allfibs == 0 && cmd == (int)RTM_ADD) { - startfib = endfib = curthread->td_proc->p_fibnum; + startfib = endfib = ifa->ifa_ifp->if_fib; } else { startfib = 0; endfib = rt_numfibs - 1; Modified: stable/10/sys/netinet/in.c ============================================================================== --- stable/10/sys/netinet/in.c Fri Jun 6 21:39:16 2014 (r267192) +++ stable/10/sys/netinet/in.c Fri Jun 6 21:45:14 2014 (r267193) @@ -1007,10 +1007,12 @@ in_scrubprefix(struct in_ifaddr *target, (target->ia_flags & IFA_RTSELF)) { struct route ia_ro; int freeit = 0; + int fib; bzero(&ia_ro, sizeof(ia_ro)); *((struct sockaddr_in *)(&ia_ro.ro_dst)) = target->ia_addr; - rtalloc_ign_fib(&ia_ro, 0, 0); + fib = target->ia_ifa.ifa_ifp->if_fib; + rtalloc_ign_fib(&ia_ro, 0, fib); if ((ia_ro.ro_rt != NULL) && (ia_ro.ro_rt->rt_ifp != NULL) && (ia_ro.ro_rt->rt_ifp == V_loif)) { RT_LOCK(ia_ro.ro_rt); Modified: stable/10/tests/sys/netinet/fibs_test.sh ============================================================================== --- stable/10/tests/sys/netinet/fibs_test.sh Fri Jun 6 21:39:16 2014 (r267192) +++ stable/10/tests/sys/netinet/fibs_test.sh Fri Jun 6 21:45:14 2014 (r267193) @@ -116,7 +116,6 @@ loopback_and_network_routes_on_nondefaul loopback_and_network_routes_on_nondefault_fib_body() { - atf_expect_fail "kern/187549 Host and network routes for a new interface appear in the wrong FIB" # Configure the TAP interface to use an RFC5737 nonrouteable address # and a non-default fib ADDR="192.0.2.2"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406062145.s56LjEKQ073872>