Avoid leaving an obsolete pointer while the interface is detaching
authorDavid Rhodus <drhodus@dragonflybsd.org>
Mon, 13 Sep 2004 23:45:57 +0000 (23:45 +0000)
committerDavid Rhodus <drhodus@dragonflybsd.org>
Mon, 13 Sep 2004 23:45:57 +0000 (23:45 +0000)
and the struct ifnet is being deleted.

Merged from fbsd pr: kern/52260

sys/net/if.c

index 8f3d1bc..c8eb143 100644 (file)
@@ -32,7 +32,7 @@
  *
  *     @(#)if.c        8.3 (Berkeley) 1/4/94
  * $FreeBSD: src/sys/net/if.c,v 1.185 2004/03/13 02:35:03 brooks Exp $ 
- * $DragonFly: src/sys/net/if.c,v 1.20 2004/09/10 14:02:00 joerg Exp $
+ * $DragonFly: src/sys/net/if.c,v 1.21 2004/09/13 23:45:57 drhodus Exp $
  */
 
 #include "opt_compat.h"
@@ -320,6 +320,8 @@ if_detach(ifp)
        /* Announce that the interface is gone. */
        rt_ifannouncemsg(ifp, IFAN_DEPARTURE);
 
+       ifindex2ifnet[ifp->if_index] = NULL;
+
        TAILQ_REMOVE(&ifnet, ifp, if_link);
        splx(s);
 }