1/* $FreeBSD$ */ 2 3/* 4 * Copyright (C) 2012 by Darren Reed. 5 * 6 * See the IPFILTER.LICENCE file for details on licencing. 7 * 8 * $Id$ 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 33extern ipf_main_softc_t ipfmain; 34 35static int 36ipfrule_modevent(module_t mod, int type, void *unused) 37{ 38 int error = 0; 39 40 switch (type) 41 { 42 case MOD_LOAD : 43 error = ipfrule_add(); 44 if (!error) 45 ipfmain.ipf_refcnt++; 46 break; 47 case MOD_UNLOAD : 48 error = ipfrule_remove(); 49 if (!error) 50 ipfmain.ipf_refcnt--; 51 break; 52 default: 53 error = EINVAL; 54 break; 55 } 56 return error; 57} 58 59static moduledata_t ipfrulemod = { 60 "ipfrule", 61 ipfrule_modevent, 62 0 63}; 64DECLARE_MODULE(ipfrule, ipfrulemod, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY); 65#ifdef MODULE_DEPEND 66MODULE_DEPEND(ipfrule, ipfilter, 1, 1, 1); 67#endif 68#ifdef MODULE_VERSION 69MODULE_VERSION(ipfrule, 1); 70#endif 71