svn commit: r339642 - head/sys/net

Andrey V. Elsukov ae at FreeBSD.org
Tue Oct 23 12:50:29 UTC 2018


Author: ae
Date: Tue Oct 23 12:50:28 2018
New Revision: 339642
URL: https://svnweb.freebsd.org/changeset/base/339642

Log:
  Remove softc from idhash when interface is destroyed.
  
  MFC after:	20 days

Modified:
  head/sys/net/if_ipsec.c

Modified: head/sys/net/if_ipsec.c
==============================================================================
--- head/sys/net/if_ipsec.c	Tue Oct 23 11:34:15 2018	(r339641)
+++ head/sys/net/if_ipsec.c	Tue Oct 23 12:50:28 2018	(r339642)
@@ -214,6 +214,12 @@ ipsec_clone_destroy(struct ifnet *ifp)
 	sx_xlock(&ipsec_ioctl_sx);
 	sc = ifp->if_softc;
 	ipsec_delete_tunnel(sc);
+	/*
+	 * Delete softc from idhash on interface destroy, since
+	 * ipsec_delete_tunnel() keeps reqid unchanged.
+	 */
+	if (sc->reqid != 0)
+		CK_LIST_REMOVE(sc, idhash);
 	bpfdetach(ifp);
 	if_detach(ifp);
 	ifp->if_softc = NULL;
@@ -1025,13 +1031,11 @@ ipsec_delete_tunnel(struct ipsec_softc *sc)
 	sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 	if (sc->family != 0) {
 		CK_LIST_REMOVE(sc, srchash);
-		IPSEC_WAIT();
-
+		sc->family = 0;
 		/*
 		 * Make sure that ipsec_if_input() will not do access
 		 * to softc's policies.
 		 */
-		sc->family = 0;
 		IPSEC_WAIT();
 
 		key_unregister_ifnet(sc->sp, IPSEC_SPCOUNT);


More information about the svn-src-all mailing list