summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2004-10-22 19:12:01 +0000
committerandre <andre@FreeBSD.org>2004-10-22 19:12:01 +0000
commit7c8480e7f11fad81e536997abda225a00a1c9205 (patch)
tree7af980e647a0f6d61156e19a2aa7d4031fe5894f /sys
parent976462622a7aaec6c473905747b400a314ad76bb (diff)
downloadFreeBSD-src-7c8480e7f11fad81e536997abda225a00a1c9205.zip
FreeBSD-src-7c8480e7f11fad81e536997abda225a00a1c9205.tar.gz
Refuse to unload the ipdivert module unless the 'force' flag is given to kldunload.
Reflect the fact that IPDIVERT is a loadable module in the divert(4) and ipfw(8) man pages.
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/ip_divert.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index d3efde0..7be0e35 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -688,8 +688,18 @@ div_modevent(module_t mod, int type, void *unused)
err = pf_proto_register(PF_INET, &div_protosw);
ip_divert_ptr = divert_packet;
break;
+ case MOD_QUIESCE:
+ /*
+ * IPDIVERT may normally not be unloaded because of the
+ * potential race conditions. Tell kldunload we can't be
+ * unloaded unless the unload is forced.
+ */
+ err = EPERM;
+ break;
case MOD_UNLOAD:
/*
+ * Forced unload.
+ *
* Module ipdivert can only be unloaded if no sockets are
* connected. Maybe this can be changed later to forcefully
* disconnect any open sockets.
@@ -712,7 +722,7 @@ div_modevent(module_t mod, int type, void *unused)
uma_zdestroy(divcbinfo.ipi_zone);
break;
default:
- return EINVAL;
+ err = EOPNOTSUPP;
break;
}
return err;
OpenPOWER on IntegriCloud