Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Add a little comment on how bpf can be made unloadab...
details: https://anonhg.NetBSD.org/src/rev/b426a3f3a54d
branches: trunk
changeset: 753950:b426a3f3a54d
user: pooka <pooka%NetBSD.org@localhost>
date: Wed Apr 14 13:31:33 2010 +0000
description:
Add a little comment on how bpf can be made unloadable, per pointer from ad.
diffstat:
sys/net/bpf.c | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diffs (45 lines):
diff -r bae5b230ea8d -r b426a3f3a54d sys/net/bpf.c
--- a/sys/net/bpf.c Wed Apr 14 13:07:19 2010 +0000
+++ b/sys/net/bpf.c Wed Apr 14 13:31:33 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bpf.c,v 1.157 2010/04/05 07:22:22 joerg Exp $ */
+/* $NetBSD: bpf.c,v 1.158 2010/04/14 13:31:33 pooka Exp $ */
/*
* Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.157 2010/04/05 07:22:22 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.158 2010/04/14 13:31:33 pooka Exp $");
#if defined(_KERNEL_OPT)
#include "opt_bpf.h"
@@ -1976,8 +1976,24 @@
case MODULE_CMD_FINI:
/*
- * bpf_ops is not (yet) referenced in the callers before
- * attach. maybe other issues too. "safety first".
+ * While there is no reference counting for bpf callers,
+ * unload could at least in theory be done similarly to
+ * system call disestablishment. This should even be
+ * a little simpler:
+ *
+ * 1) replace op vector with stubs
+ * 2) post update to all cpus with xc
+ * 3) check that nobody is in bpf anymore
+ * (it's doubtful we'd want something like l_sysent,
+ * but we could do something like *signed* percpu
+ * counters. if the sum is 0, we're good).
+ * 4) if fail, unroll changes
+ *
+ * NOTE: change won't be atomic to the outside. some
+ * packets may be not captured even if unload is
+ * not succesful. I think packet capture not working
+ * is a perfectly logical consequence of trying to
+ * disable packet capture.
*/
error = EOPNOTSUPP;
break;
Home |
Main Index |
Thread Index |
Old Index