Module Name: src
Committed By: ozaki-r
Date: Fri Nov 20 08:10:36 UTC 2015
Modified Files:
src/sys/net: if.c
Log Message:
Remove an ifnet object from the global list before destructing it
To generate a diff of this commit:
cvs rdiff -u -r1.318 -r1.319 src/sys/net/if.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.318 src/sys/net/if.c:1.319
--- src/sys/net/if.c:1.318 Mon Aug 31 08:02:44 2015
+++ src/sys/net/if.c Fri Nov 20 08:10:36 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.318 2015/08/31 08:02:44 ozaki-r Exp $ */
+/* $NetBSD: if.c,v 1.319 2015/11/20 08:10:36 ozaki-r Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.318 2015/08/31 08:02:44 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.319 2015/11/20 08:10:36 ozaki-r Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -756,6 +756,9 @@ if_detach(struct ifnet *ifp)
s = splnet();
+ ifindex2ifnet[ifp->if_index] = NULL;
+ TAILQ_REMOVE(&ifnet_list, ifp, if_list);
+
if (ifp->if_slowtimo != NULL) {
ifp->if_slowtimo = NULL;
callout_halt(ifp->if_slowtimo_ch, NULL);
@@ -890,10 +893,6 @@ again:
/* Announce that the interface is gone. */
rt_ifannouncemsg(ifp, IFAN_DEPARTURE);
- ifindex2ifnet[ifp->if_index] = NULL;
-
- TAILQ_REMOVE(&ifnet_list, ifp, if_list);
-
ifioctl_detach(ifp);
/*