1
2/*
3 * Copyright (C) 2012 by Darren Reed.
4 *
5 * See the IPFILTER.LICENCE file for details on licencing.
6 *
7 * $Id$
8 */
9
10
11#include <sys/param.h>
12#include <sys/systm.h>
13#include <sys/kernel.h>
14#include <sys/module.h>
15#include <sys/conf.h>
16#include <sys/socket.h>
17#include <sys/sysctl.h>
18#include <net/if.h>
19#include <netinet/in_systm.h>
20#include <netinet/in.h>
21
22#include <netinet/ipl.h>
23#include <netinet/ip_compat.h>
24#include <netinet/ip_fil.h>
25#include <netinet/ip_state.h>
26#include <netinet/ip_nat.h>
27#include <netinet/ip_auth.h>
28#include <netinet/ip_frag.h>
29
30#include "ip_rules.h"
31
32extern ipf_main_softc_t ipfmain;
33
34static int
35ipfrule_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			ipfmain.ipf_refcnt++;
45		break;
46	case MOD_UNLOAD :
47		error = ipfrule_remove();
48		if (!error)
49			ipfmain.ipf_refcnt--;
50		break;
51	default:
52		error = EINVAL;
53		break;
54	}
55	return(error);
56}
57
58static moduledata_t ipfrulemod = {
59	"ipfrule",
60	ipfrule_modevent,
61        0
62};
63DECLARE_MODULE(ipfrule, ipfrulemod, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY);
64#ifdef	MODULE_DEPEND
65MODULE_DEPEND(ipfrule, ipfilter, 1, 1, 1);
66#endif
67#ifdef	MODULE_VERSION
68MODULE_VERSION(ipfrule, 1);
69#endif
70