summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_accf.c
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2000-09-06 18:49:13 +0000
committeralfred <alfred@FreeBSD.org>2000-09-06 18:49:13 +0000
commitbaac93215b7e569a555cb4ba9d3c4cf86f39f708 (patch)
tree1b1e786cd443d3f24c0a1523674f752cb38e6796 /sys/kern/uipc_accf.c
parent007386c316e52563bf632587c6713b8ca8891e2c (diff)
downloadFreeBSD-src-baac93215b7e569a555cb4ba9d3c4cf86f39f708.zip
FreeBSD-src-baac93215b7e569a555cb4ba9d3c4cf86f39f708.tar.gz
Accept filter maintainance
Update copyrights. Introduce a new sysctl node: net.inet.accf Although acceptfilters need refcounting to be properly (safely) unloaded as a temporary hack allow them to be unloaded if the sysctl net.inet.accf.unloadable is set, this is really for developers who want to work on thier own filters. A near complete re-write of the accf_http filter: 1) Parse check if the request is HTTP/1.0 or HTTP/1.1 if not dump to the application. Because of the performance implications of this there is a sysctl 'net.inet.accf.http.parsehttpversion' that when set to non-zero parses the HTTP version. The default is to parse the version. 2) Check if a socket has filled and dump to the listener 3) optimize the way that mbuf boundries are handled using some voodoo 4) even though you'd expect accept filters to only be used on TCP connections that don't use m_nextpkt I've fixed the accept filter for socket connections that use this. This rewrite of accf_http should allow someone to use them and maintain full HTTP compliance as long as net.inet.accf.http.parsehttpversion is set.
Diffstat (limited to 'sys/kern/uipc_accf.c')
-rw-r--r--sys/kern/uipc_accf.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/sys/kern/uipc_accf.c b/sys/kern/uipc_accf.c
index e6b7d61..08cca1e 100644
--- a/sys/kern/uipc_accf.c
+++ b/sys/kern/uipc_accf.c
@@ -1,5 +1,6 @@
-/*-
- * Copyright (c) 2000 Alfred Perlstein <alfred@FreeBSD.org>
+/*
+ * Copyright (c) 2000 Paycounter, Inc.
+ * Author: Alfred Perlstein <alfred@paycounter.com>, <alfred@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,6 +38,7 @@
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/protosw.h>
+#include <sys/sysctl.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/queue.h>
@@ -46,6 +48,13 @@ static SLIST_HEAD(, accept_filter) accept_filtlsthd =
MALLOC_DEFINE(M_ACCF, "accf", "accept filter data");
+static int unloadable = 0;
+
+SYSCTL_DECL(_net_inet); /* XXX: some header should do this for me */
+SYSCTL_NODE(_net_inet, OID_AUTO, accf, CTLFLAG_RW, 0, "Accept filters");
+SYSCTL_INT(_net_inet_accf, OID_AUTO, unloadable, CTLFLAG_RW, &unloadable, 0,
+ "Allow unload of accept filters (not recommended)");
+
/*
* must be passed a malloc'd structure so we don't explode if the kld
* is unloaded, we leak the struct on deallocation to deal with this,
@@ -121,12 +130,12 @@ accept_filt_generic_mod_event(module_t mod, int event, void *data)
* is a bad thing. A simple fix would be to track the refcount
* in the struct accept_filter.
*/
-#if 0
- s = splnet();
- error = accept_filt_del(accfp->accf_name);
- splx(s);
-#endif
- error = EOPNOTSUPP;
+ if (unloadable != 0) {
+ s = splnet();
+ error = accept_filt_del(accfp->accf_name);
+ splx(s);
+ } else
+ error = EOPNOTSUPP;
break;
case MOD_SHUTDOWN:
OpenPOWER on IntegriCloud