/* $NetBSD: mlso_rule.c,v 1.1.1.1 2004/03/28 08:55:48 martti Exp $ */ /* * Copyright (C) 2000 by Darren Reed. * * See the IPFILTER.LICENCE file for details on licencing. */ #pragma ident "@(#)Id: mlso_rule.c,v 2.4 2002/08/10 14:00:15 darrenr Exp" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if SOLARIS2 >= 6 # include #endif #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" char _depends_on[] = "drv/ipf"; extern struct mod_ops mod_miscops; static struct modlmisc ipfrulemod = { &mod_miscops, "IP Filter rules" }; static struct modlinkage modlink1 = { MODREV_1, &ipfrulemod, NULL }; int _init() { int ipfruleinst; ipfruleinst = mod_install(&modlink1); #ifdef IPFRULEDEBUG cmn_err(CE_NOTE, "IP Filter Rules: _init() = %d", ipfruleinst); #endif if (ipfruleinst == 0) { if (fr_running >= 0) { ipfruleinst = ipfrule_add(); if (!ipfruleinst) fr_refcnt++; else { cmn_err(CE_NOTE, "IP Filter Rules: ipfrule_add failed"); ipfruleinst = -1; } } else ipfruleinst = -1; } if (ipfruleinst == 0) cmn_err(CE_CONT, "IP Filter Rules: loaded\n"); return ipfruleinst; } int _fini(void) { int ipfruleinst; ipfruleinst = mod_remove(&modlink1); #ifdef IPFRULEDEBUG cmn_err(CE_NOTE, "IP Filter Rules: _fini() = %d", ipfruleinst); #endif if (ipfruleinst == 0) { ipfruleinst = ipfrule_remove(); if (!ipfruleinst) fr_refcnt--; else ipfruleinst = -1; } if (ipfruleinst == 0) cmn_err(CE_CONT, "IP Filter Rules: unloaded\n"); return ipfruleinst; } int _info(modinfop) struct modinfo *modinfop; { int ipfruleinst; ipfruleinst = mod_info(&modlink1, modinfop); #ifdef IPFRULEDEBUG cmn_err(CE_NOTE, "IP Filter Rules: _info(%x) = %x", modinfop, ipfruleinst); #endif return ipfruleinst; }