⬢ DragonFlyBSD Kernel Audit
DF-3395 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/net/if.c b/sys/net/if.c
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -2203,7 +2203,13 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct ucred *cred)
 			break;
 		}
 
+		/*
+		 * DF-3395: a rename is an announcement, not a detach.
+		 * Firing ifnet_detach_event here makes every subscriber
+		 * (vlan unconfig, bridge member removal, ...) tear down
+		 * state for an interface that continues to exist.  Use the
+		 * departure announcement instead; ifnet_detach_event stays
+		 * reserved for real destruction in if_detach().
+		 */
-		EVENTHANDLER_INVOKE(ifnet_detach_event, ifp);
+		EVENTHANDLER_INVOKE(ifnet_departure_event, ifp);
 
 		/* Announce the departure of the interface. */
 		rt_ifannouncemsg(ifp, IFAN_DEPARTURE);