/* $NetBSD: mlo_rule.c,v 1.1.1.1 2004/03/28 08:55:48 martti Exp $ */ /* * Copyright (C) 1993-2001 by Darren Reed. * * See the IPFILTER.LICENCE file for details on licencing. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "ip_compat.h" #include "ip_fil.h" #include "ip_rules.h" #ifdef IPFILTER_LKM static int ipfruleaction __P((struct lkm_table *, int)); int ipfrule __P((struct lkm_table *, int, int)); MOD_MISC("IPFilter Rules"); int ipfrule(lkmtp, cmd, ver) struct lkm_table *lkmtp; int cmd, ver; { DISPATCH(lkmtp, cmd, ver, ipfruleaction, ipfruleaction, ipfruleaction); } int lkmexists __P((struct lkm_table *)); /* defined in /sys/kern/kern_lkm.c */ static int ipfruleaction(lkmtp, cmd) struct lkm_table *lkmtp; int cmd; { int err = 0; switch (cmd) { case LKM_E_LOAD : if (lkmexists(lkmtp)) return EEXIST; err = ipfrule_add(); if (!err) fr_refcnt++; break; case LKM_E_UNLOAD : err = ipfrule_remove(); if (!err) fr_refcnt--; break; case LKM_E_STAT : break; default: err = EIO; break; } return err; } #endif /* IPFILTER_LKM */