From owner-svn-src-all@FreeBSD.ORG Thu Sep 18 20:53:38 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F0D5F20B; Thu, 18 Sep 2014 20:53:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DA2152E0; Thu, 18 Sep 2014 20:53:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8IKrbKA058673; Thu, 18 Sep 2014 20:53:37 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8IKrbBa058668; Thu, 18 Sep 2014 20:53:37 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201409182053.s8IKrbBa058668@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 18 Sep 2014 20:53:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r271825 - in stable/9/sys: net netinet X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Sep 2014 20:53:38 -0000 Author: asomers Date: Thu Sep 18 20:53:36 2014 New Revision: 271825 URL: http://svnweb.freebsd.org/changeset/base/271825 Log: MFC r264887, except for the ATF test change. Also, ifa_switch_loopback_route doesn't exist in stable/9, so the relevant change to that function went into in_scrubprefix instead. 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. PR: kern/187549 Modified: stable/9/sys/net/if.c stable/9/sys/net/route.c stable/9/sys/netinet/in.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/net/ (props changed) Modified: stable/9/sys/net/if.c ============================================================================== --- stable/9/sys/net/if.c Thu Sep 18 20:53:02 2014 (r271824) +++ stable/9/sys/net/if.c Thu Sep 18 20:53:36 2014 (r271825) @@ -1479,7 +1479,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); @@ -1511,7 +1511,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_INFO, "ifa_del_loopback_route: deletion failed\n"); Modified: stable/9/sys/net/route.c ============================================================================== --- stable/9/sys/net/route.c Thu Sep 18 20:53:02 2014 (r271824) +++ stable/9/sys/net/route.c Thu Sep 18 20:53:36 2014 (r271825) @@ -1527,7 +1527,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/9/sys/netinet/in.c ============================================================================== --- stable/9/sys/netinet/in.c Thu Sep 18 20:53:02 2014 (r271824) +++ stable/9/sys/netinet/in.c Thu Sep 18 20:53:36 2014 (r271825) @@ -1069,7 +1069,7 @@ in_scrubprefix(struct in_ifaddr *target, bzero(&ia_ro, sizeof(ia_ro)); *((struct sockaddr_in *)(&ia_ro.ro_dst)) = target->ia_addr; - rtalloc_ign_fib(&ia_ro, 0, 0); + rtalloc_ign_fib(&ia_ro, 0, fibnum); 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);