Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Oct 2018 12:50:29 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r339642 - head/sys/net
Message-ID:  <201810231250.w9NCoTRZ005992@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



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