1 /*	$FreeBSD: stable/9/contrib/ipfilter/mlfk_rule.c 153881 2005-12-30 11:52:26Z guido $	*/
2 
3 /*
4  * Copyright (C) 2000 by Darren Reed.
5  *
6  * See the IPFILTER.LICENCE file for details on licencing.
7  *
8  * $Id: mlfk_rule.c,v 2.4.4.2 2004/04/16 23:32:08 darrenr Exp $
9  */
10 
11 
12 #include <sys/param.h>
13 #include <sys/systm.h>
14 #include <sys/kernel.h>
15 #include <sys/module.h>
16 #include <sys/conf.h>
17 #include <sys/socket.h>
18 #include <sys/sysctl.h>
19 #include <net/if.h>
20 #include <netinet/in_systm.h>
21 #include <netinet/in.h>
22 
23 #include <netinet/ipl.h>
24 #include <netinet/ip_compat.h>
25 #include <netinet/ip_fil.h>
26 #include <netinet/ip_state.h>
27 #include <netinet/ip_nat.h>
28 #include <netinet/ip_auth.h>
29 #include <netinet/ip_frag.h>
30 
31 #include "ip_rules.h"
32 
33 
34 static int
ipfrule_modevent(module_t mod,int type,void * unused)35 ipfrule_modevent(module_t mod, int type, void *unused)
36 {
37 	int error = 0;
38 
39 	switch (type)
40 	{
41 	case MOD_LOAD :
42 		error = ipfrule_add();
43 		if (!error)
44 			fr_refcnt++;
45 		break;
46 	case MOD_UNLOAD :
47 		error = ipfrule_remove();
48 		if (!error)
49 			fr_refcnt--;
50 		break;
51 	default:
52 		error = EINVAL;
53 		break;
54 	}
55 	return error;
56 }
57 
58 static moduledata_t ipfrulemod = {
59 	"ipfrule",
60 	ipfrule_modevent,
61         0
62 };
63 DECLARE_MODULE(ipfrule, ipfrulemod, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY);
64 #ifdef	MODULE_DEPEND
65 MODULE_DEPEND(ipfrule, ipfilter, 1, 1, 1);
66 #endif
67 #ifdef	MODULE_VERSION
68 MODULE_VERSION(ipfrule, 1);
69 #endif
70