Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Jan 2025 15:27:37 GMT
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 20374abf0ce8 - stable/13 - if_vxlan(4): Invoke vxlan_stop event handler only when the interface is configured
Message-ID:  <202501281527.50SFRboV072213@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=20374abf0ce8228972f54795bf7ac6266be190ef

commit 20374abf0ce8228972f54795bf7ac6266be190ef
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2025-01-21 15:02:13 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2025-01-28 15:26:49 +0000

    if_vxlan(4): Invoke vxlan_stop event handler only when the interface is configured
    
    It is harmless but pointless to invoke vxlan_stop event handler when the
    interface was not previously configured. This change will also prevent
    an assert panic from t4_vxlan_stop_handler().
    
    Reviewed by:    kib
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D48494
    
    (cherry picked from commit 960c5bb0f6bf44aeb09fa14fd0f82c2e82ebe2e2)
    (cherry picked from commit aa79996e605735dcd9b1bf83d6affefa404530d1)
---
 sys/net/if_vxlan.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c
index 2c1bfcc2e4da..827772063ede 100644
--- a/sys/net/if_vxlan.c
+++ b/sys/net/if_vxlan.c
@@ -1812,6 +1812,7 @@ vxlan_teardown_locked(struct vxlan_softc *sc)
 {
 	struct ifnet *ifp;
 	struct vxlan_socket *vso;
+	bool running;
 
 	sx_assert(&vxlan_sx, SA_XLOCKED);
 	VXLAN_LOCK_WASSERT(sc);
@@ -1819,6 +1820,7 @@ vxlan_teardown_locked(struct vxlan_softc *sc)
 
 	ifp = sc->vxl_ifp;
 	ifp->if_flags &= ~IFF_UP;
+	running = (ifp->if_drv_flags & IFF_DRV_RUNNING) != 0;
 	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 	callout_stop(&sc->vxl_callout);
 	vso = sc->vxl_sock;
@@ -1826,8 +1828,10 @@ vxlan_teardown_locked(struct vxlan_softc *sc)
 
 	VXLAN_WUNLOCK(sc);
 	if_link_state_change(ifp, LINK_STATE_DOWN);
-	EVENTHANDLER_INVOKE(vxlan_stop, ifp, sc->vxl_src_addr.in4.sin_family,
-	    ntohs(sc->vxl_src_addr.in4.sin_port));
+	if (running)
+		EVENTHANDLER_INVOKE(vxlan_stop, ifp,
+		    sc->vxl_src_addr.in4.sin_family,
+		    ntohs(sc->vxl_src_addr.in4.sin_port));
 
 	if (vso != NULL) {
 		vxlan_socket_remove_softc(vso, sc);



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