The branch stable/13 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=20374abf0ce8228972f54795bf7ac6266be190ef
commit 20374abf0ce8228972f54795bf7ac6266be190ef Author: Zhenlei Huang <z...@freebsd.org> AuthorDate: 2025-01-21 15:02:13 +0000 Commit: Zhenlei Huang <z...@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);