Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Sep 2014 22:12:52 +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-9@freebsd.org
Subject:   svn commit: r271842 - stable/9/sys/netinet
Message-ID:  <201409182212.s8IMCqNw097875@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers
Date: Thu Sep 18 22:12:52 2014
New Revision: 271842
URL: http://svnweb.freebsd.org/changeset/base/271842

Log:
  MFC r265092, except for the ATF bits.
  
  Fix a panic when removing an IP address from an interface, if the same address
  exists on another interface.  The panic was introduced by change 264887, which
  changed the fibnum parameter in the call to rtalloc1_fib() in
  ifa_switch_loopback_route() from RT_DEFAULT_FIB to RT_ALL_FIBS.  The solution
  is to use the interface fib in that call.  For the majority of users, that will
  be equivalent to the legacy behavior.
  
  PR:             kern/189089

Modified:
  stable/9/sys/netinet/in.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netinet/in.c
==============================================================================
--- stable/9/sys/netinet/in.c	Thu Sep 18 22:10:49 2014	(r271841)
+++ stable/9/sys/netinet/in.c	Thu Sep 18 22:12:52 2014	(r271842)
@@ -1051,11 +1051,9 @@ in_scrubprefix(struct in_ifaddr *target,
 {
 	struct in_ifaddr *ia;
 	struct in_addr prefix, mask, p;
-	int error = 0, fibnum;
+	int error = 0;
 	struct sockaddr_in prefix0, mask0;
 
-	fibnum = rt_add_addr_allfibs ? RT_ALL_FIBS : target->ia_ifp->if_fib;
-
 	/*
 	 * Remove the loopback route to the interface address.
 	 * The "useloopback" setting is not consulted because if the
@@ -1071,9 +1069,11 @@ in_scrubprefix(struct in_ifaddr *target,
 	    (target->ia_flags & IFA_RTSELF)) {
 		struct route ia_ro;
 		int freeit = 0;
+		int fibnum;
 
 		bzero(&ia_ro, sizeof(ia_ro));
 		*((struct sockaddr_in *)(&ia_ro.ro_dst)) = target->ia_addr;
+		fibnum = target->ia_ifp->if_fib;
 		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)) {
@@ -1107,6 +1107,10 @@ in_scrubprefix(struct in_ifaddr *target,
 	}
 
 	if ((target->ia_flags & IFA_ROUTE) == 0) {
+		int fibnum;
+		
+		fibnum = rt_add_addr_allfibs ? RT_ALL_FIBS :
+			target->ia_ifp->if_fib;
 		rt_addrmsg(RTM_DELETE, &target->ia_ifa, fibnum);
 		return (0);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409182212.s8IMCqNw097875>