On 19/03/18(Mon) 15:58, Stefan Sperling wrote:
> The following will trigger "panic: rw_enter: netlock locking against myself":
The solution is to call bpfdetach() outside of the NET_LOCK(), it should
not need it. Diff below does that, does it work for you?
Index: net/if.c
===================================================================
RCS file: /cvs/src/sys/net/if.c,v
retrieving revision 1.548
diff -u -p -r1.548 if.c
--- net/if.c 2 Mar 2018 15:52:11 -0000 1.548
+++ net/if.c 19 Mar 2018 15:22:17 -0000
@@ -1028,6 +1028,10 @@ if_detach(struct ifnet *ifp)
/* Other CPUs must not have a reference before we start destroying. */
if_idxmap_remove(ifp);
+#if NBPFILTER > 0
+ bpfdetach(ifp);
+#endif
+
NET_LOCK();
s = splnet();
ifp->if_qstart = if_detached_qstart;
@@ -1041,9 +1045,6 @@ if_detach(struct ifnet *ifp)
/* Remove the link state task */
task_del(net_tq(ifp->if_index), &ifp->if_linkstatetask);
-#if NBPFILTER > 0
- bpfdetach(ifp);
-#endif
rti_delete(ifp);
#if NETHER > 0 && defined(NFSCLIENT)
if (ifp->if_index == revarp_ifidx)