Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 May 2018 09:40:52 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r333624 - stable/11/sys/netinet6
Message-ID:  <201805150940.w4F9eqHV045320@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Tue May 15 09:40:52 2018
New Revision: 333624
URL: https://svnweb.freebsd.org/changeset/base/333624

Log:
  MFC r333362:
  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.
  
  Approved by:	re (marius)
  Reviewed by:	network (ae), kib
  Differential Revision:	https://reviews.freebsd.org/D13407
  Sponsored by:	Mellanox Technologies

Modified:
  stable/11/sys/netinet6/in6.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet6/in6.c
==============================================================================
--- stable/11/sys/netinet6/in6.c	Tue May 15 07:46:24 2018	(r333623)
+++ stable/11/sys/netinet6/in6.c	Tue May 15 09:40:52 2018	(r333624)
@@ -677,7 +677,6 @@ aifaddr_out:
 			 * The failure means address duplication was detected.
 			 */
 		}
-		EVENTHANDLER_INVOKE(ifaddr_event, ifp);
 		break;
 	}
 
@@ -1364,7 +1363,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;
 	}
 
 	/*
@@ -1404,7 +1403,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;
 	}
 
@@ -1417,6 +1416,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);
 }



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