svn commit: r333362 - head/sys/netinet6

Hans Petter Selasky hselasky at FreeBSD.org
Tue May 8 11:39:03 UTC 2018


Author: hselasky
Date: Tue May  8 11:39:01 2018
New Revision: 333362
URL: https://svnweb.freebsd.org/changeset/base/333362

Log:
  Fix for missing network interface address event when adding the default IPv6
  based link-local address.
  
  The default link local address for IPv6 is added as part of bringing the
  network interface up. Move the call to "EVENTHANDLER_INVOKE(ifaddr_event,)"
  from the SIOCAIFADDR_IN6 ioctl(2) handler to in6_notify_ifa() which should
  catch all the cases of adding IPv6 based addresses to a network interface.
  Add a witness warning in case the event handler is not allowed to sleep.
  
  Reviewed by:	network (ae), kib
  Differential Revision:	https://reviews.freebsd.org/D13407
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies

Modified:
  head/sys/netinet6/in6.c

Modified: head/sys/netinet6/in6.c
==============================================================================
--- head/sys/netinet6/in6.c	Tue May  8 10:56:06 2018	(r333361)
+++ head/sys/netinet6/in6.c	Tue May  8 11:39:01 2018	(r333362)
@@ -686,7 +686,6 @@ aifaddr_out:
 			 * The failure means address duplication was detected.
 			 */
 		}
-		EVENTHANDLER_INVOKE(ifaddr_event, ifp);
 		break;
 	}
 
@@ -1399,7 +1398,7 @@ in6_notify_ifa(struct ifnet *ifp, struct in6_ifaddr *i
 	if (ifacount <= 1 && ifp->if_ioctl) {
 		error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (caddr_t)ia);
 		if (error)
-			return (error);
+			goto done;
 	}
 
 	/*
@@ -1439,7 +1438,7 @@ in6_notify_ifa(struct ifnet *ifp, struct in6_ifaddr *i
 			ia->ia_flags |= IFA_RTSELF;
 		error = rtinit(&ia->ia_ifa, RTM_ADD, ia->ia_flags | rtflags);
 		if (error)
-			return (error);
+			goto done;
 		ia->ia_flags |= IFA_ROUTE;
 	}
 
@@ -1452,6 +1451,11 @@ in6_notify_ifa(struct ifnet *ifp, struct in6_ifaddr *i
 		if (error == 0)
 			ia->ia_flags |= IFA_RTSELF;
 	}
+done:
+	WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
+	    "Invoking IPv6 network device address event may sleep");
+
+	EVENTHANDLER_INVOKE(ifaddr_event, ifp);
 
 	return (error);
 }


More information about the svn-src-head mailing list