Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 May 2011 02:21:35 +0000 (UTC)
From:      Qing Li <qingli@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r222438 - head/sys/netinet
Message-ID:  <201105290221.p4T2LZtf010422@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: qingli
Date: Sun May 29 02:21:35 2011
New Revision: 222438
URL: http://svn.freebsd.org/changeset/base/222438

Log:
  Supply the LLE_STATIC flag bit to in_ifscurb() when scrubbing interface
  address so that proper clean up will take place in the routing code.
  This patch fixes the bootp panic on startup problem. Also, added more
  error handling and logging code in function in_scrubprefix().
  
  MFC after:	5 days

Modified:
  head/sys/netinet/in.c

Modified: head/sys/netinet/in.c
==============================================================================
--- head/sys/netinet/in.c	Sun May 29 02:10:57 2011	(r222437)
+++ head/sys/netinet/in.c	Sun May 29 02:21:35 2011	(r222438)
@@ -548,7 +548,7 @@ in_control(struct socket *so, u_long cmd
 			 * is the same as before, then the call is 
 			 * un-necessarily executed here.
 			 */
-			in_ifscrub(ifp, ia, 0);
+			in_ifscrub(ifp, ia, LLE_STATIC);
 			ia->ia_sockmask = ifra->ifra_mask;
 			ia->ia_sockmask.sin_family = AF_INET;
 			ia->ia_subnetmask =
@@ -557,7 +557,7 @@ in_control(struct socket *so, u_long cmd
 		}
 		if ((ifp->if_flags & IFF_POINTOPOINT) &&
 		    (ifra->ifra_dstaddr.sin_family == AF_INET)) {
-			in_ifscrub(ifp, ia, 0);
+			in_ifscrub(ifp, ia, LLE_STATIC);
 			ia->ia_dstaddr = ifra->ifra_dstaddr;
 			maskIsNew  = 1; /* We lie; but the effect's the same */
 		}
@@ -1179,14 +1179,20 @@ in_scrubprefix(struct in_ifaddr *target,
 		    && (ia->ia_ifp->if_type != IFT_CARP)) {
 			ifa_ref(&ia->ia_ifa);
 			IN_IFADDR_RUNLOCK();
-			rtinit(&(target->ia_ifa), (int)RTM_DELETE,
+			error = rtinit(&(target->ia_ifa), (int)RTM_DELETE,
 			    rtinitflags(target));
-			target->ia_flags &= ~IFA_ROUTE;
-
+			if (error == 0)
+				target->ia_flags &= ~IFA_ROUTE;
+			else
+				log(LOG_INFO, "in_scrubprefix: err=%d, old prefix delete failed\n",
+					error);
 			error = rtinit(&ia->ia_ifa, (int)RTM_ADD,
 			    rtinitflags(ia) | RTF_UP);
 			if (error == 0)
 				ia->ia_flags |= IFA_ROUTE;
+			else
+				log(LOG_INFO, "in_scrubprefix: err=%d, new prefix add failed\n",
+					error);
 			ifa_free(&ia->ia_ifa);
 			return (error);
 		}
@@ -1210,9 +1216,12 @@ in_scrubprefix(struct in_ifaddr *target,
 	/*
 	 * As no-one seem to have this prefix, we can remove the route.
 	 */
-	rtinit(&(target->ia_ifa), (int)RTM_DELETE, rtinitflags(target));
-	target->ia_flags &= ~IFA_ROUTE;
-	return (0);
+	error = rtinit(&(target->ia_ifa), (int)RTM_DELETE, rtinitflags(target));
+	if (error == 0)
+		target->ia_flags &= ~IFA_ROUTE;
+	else
+		log(LOG_INFO, "in_scrubprefix: err=%d, prefix delete failed\n", error);
+	return (error);
 }
 
 #undef rtinitflags



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