Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / ipf / mln_rule.c
blob76bf00d2c1b895a25e9e3da4e28d6c9b58d7317c
1 /* $NetBSD$ */
3 /*
4 * Copyright (C) 1993-2001 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
8 */
10 #include <sys/param.h>
11 #include <sys/systm.h>
12 #include <sys/conf.h>
13 #include <sys/proc.h>
14 #include <sys/ioctl.h>
15 #include <sys/kernel.h>
16 #include <sys/mbuf.h>
17 #include <sys/exec.h>
18 #include <sys/socket.h>
19 #include <net/if.h>
20 #include <netinet/in_systm.h>
21 #include <netinet/in.h>
22 #include <netinet/ip.h>
23 #include <net/route.h>
24 #include <netinet/ip_var.h>
25 #include <netinet/tcp.h>
26 #include <netinet/tcpip.h>
27 #include <sys/lkm.h>
28 #include "ip_compat.h"
29 #include "ip_fil.h"
30 #include "ip_rules.h"
33 static int ipfruleaction __P((struct lkm_table *, int));
35 #ifdef IPFILTER_LKM
36 # if NetBSD >= 199706
37 int ipfrule_lkmentry __P((struct lkm_table *, int, int));
38 # else
39 int xxxinit __P((struct lkm_table *, int, int));
40 # endif
43 MOD_MISC("IPFilter Rules");
45 # if NetBSD >= 199706
46 int ipfrule_lkmentry(lkmtp, cmd, ver)
47 # else
48 int xxxinit(lkmtp, cmd, ver)
49 # endif
50 struct lkm_table *lkmtp;
51 int cmd, ver;
53 DISPATCH(lkmtp, cmd, ver, ipfruleaction, ipfruleaction, ipfruleaction);
56 static int ipfruleaction(lkmtp, cmd)
57 struct lkm_table *lkmtp;
58 int cmd;
60 int err = 0;
62 switch (cmd)
64 case LKM_E_LOAD :
65 if (lkmexists(lkmtp))
66 return EEXIST;
68 err = ipfrule_add();
69 if (!err)
70 fr_refcnt++;
71 break;
72 case LKM_E_UNLOAD :
73 err = ipfrule_remove();
74 if (!err)
75 fr_refcnt--;
76 break;
77 case LKM_E_STAT :
78 break;
79 default:
80 err = EIO;
81 break;
83 return err;
85 #endif /* IPFILTER_LKM */