diff options
Diffstat (limited to 'sys/netinet/accf_http.c')
| -rw-r--r-- | sys/netinet/accf_http.c | 84 |
1 files changed, 41 insertions, 43 deletions
diff --git a/sys/netinet/accf_http.c b/sys/netinet/accf_http.c index b61bf9eb7cc..86efbbb9f79 100644 --- a/sys/netinet/accf_http.c +++ b/sys/netinet/accf_http.c @@ -1,4 +1,4 @@ -/* $NetBSD: accf_http.c,v 1.2 2008/10/14 13:05:44 ad Exp $ */ +/* $NetBSD: accf_http.c,v 1.3 2008/11/12 12:36:28 ad Exp $ */ /*- * Copyright (c) 2000 Paycounter, Inc. @@ -28,14 +28,14 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: accf_http.c,v 1.2 2008/10/14 13:05:44 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: accf_http.c,v 1.3 2008/11/12 12:36:28 ad Exp $"); #define ACCEPT_FILTER_MOD #include <sys/param.h> #include <sys/kernel.h> #include <sys/mbuf.h> -#include <sys/lkm.h> +#include <sys/module.h> #include <sys/signalvar.h> #include <sys/sysctl.h> #include <sys/socket.h> @@ -43,6 +43,8 @@ __KERNEL_RCSID(0, "$NetBSD: accf_http.c,v 1.2 2008/10/14 13:05:44 ad Exp $"); #include <netinet/accept_filter.h> +MODULE(MODULE_CLASS_MISC, accf_http, NULL); + /* check for GET/HEAD */ static void sohashttpget(struct socket *so, void *arg, int waitflag); /* check for HTTP/1.0 or HTTP/1.1 */ @@ -70,30 +72,49 @@ static struct accept_filter accf_http_filter = { static int parse_http_version = 1; -SYSCTL_SETUP(sysctl_net_inet_accf__http_setup, "sysctl net.inet.accf.http subtree setup") +/* XXX pseudo-device */ +void accf_httpattach(int); + +void +accf_httpattach(int junk) +{ + +} + +static int +accf_http_modcmd(modcmd_t cmd, void *arg) { - sysctl_createv(clog, 0, NULL, NULL, + static struct sysctllog *clog; + int error; + + switch (cmd) { + case MODULE_CMD_INIT: + error = accept_filt_add(&accf_http_filter); + if (error != 0) { + return error; + } + sysctl_createv(&clog, 0, NULL, NULL, CTLFLAG_PERMANENT, CTLTYPE_NODE, "net", NULL, NULL, 0, NULL, 0, CTL_NET, CTL_EOL); - sysctl_createv(clog, 0, NULL, NULL, + sysctl_createv(&clog, 0, NULL, NULL, CTLFLAG_PERMANENT, CTLTYPE_NODE, "inet", NULL, NULL, 0, NULL, 0, CTL_NET, PF_INET, CTL_EOL); - sysctl_createv(clog, 0, NULL, NULL, + sysctl_createv(&clog, 0, NULL, NULL, CTLFLAG_PERMANENT, CTLTYPE_NODE, "accf", NULL, NULL, 0, NULL, 0, CTL_NET, PF_INET, SO_ACCEPTFILTER, CTL_EOL); - sysctl_createv(clog, 0, NULL, NULL, + sysctl_createv(&clog, 0, NULL, NULL, CTLFLAG_PERMANENT, CTLTYPE_NODE, "http", SYSCTL_DESCR("HTTP accept filter"), NULL, 0, NULL, 0, CTL_NET, PF_INET, SO_ACCEPTFILTER, ACCF_HTTP, CTL_EOL); - sysctl_createv(clog, 0, NULL, NULL, + sysctl_createv(&clog, 0, NULL, NULL, CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_INT, "parsehttpversion", SYSCTL_DESCR("Parse http version so that non " @@ -101,43 +122,20 @@ SYSCTL_SETUP(sysctl_net_inet_accf__http_setup, "sysctl net.inet.accf.http subtre NULL, 0, &parse_http_version, 0, CTL_NET, PF_INET, SO_ACCEPTFILTER, ACCF_HTTP, ACCFCTL_PARSEVER, CTL_EOL); -} - -void accf_httpattach(int); -void accf_httpattach(int num) -{ - accept_filt_generic_mod_event(NULL, LKM_E_LOAD, &accf_http_filter); -} - -/* - * This code is to make HTTP ready accept filer as LKM. - * To compile as LKM we need to move this set of code into - * another file and include this file for compilation when - * making LKM - */ - -#ifdef _LKM -static int accf_http_handle(struct lkm_table * lkmtp, int cmd); -int accf_http_lkmentry(struct lkm_table * lkmtp, int cmd, int ver); - -MOD_MISC("accf_http"); + return 0; -static int accf_http_handle(struct lkm_table * lkmtp, int cmd) -{ - - return accept_filt_generic_mod_event(lkmtp, cmd, &accf_http_filter); -} + case MODULE_CMD_FINI: + error = accept_filt_del(&accf_http_filter); + if (error != 0) { + return error; + } + sysctl_teardown(&clog); + return 0; -/* - * the module entry point. - */ -int -accf_http_lkmentry(struct lkm_table *lkmtp, int cmd, int ver) -{ - DISPATCH(lkmtp, cmd, ver, accf_http_handle, accf_http_handle, - accf_http_handle) + default: + return ENOTTY; + } } -#endif #ifdef ACCF_HTTP_DEBUG #define DPRINT(fmt, args...) \ |
