4 * Copyright (C) 1993-2001 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
9 * 29/12/94 Added code from Marc Huber <huber@fzi.de> to allow it to allocate
10 * its own major char number! Way cool patch!
14 #include <sys/param.h>
16 #if defined(__FreeBSD__) && (__FreeBSD__ > 1)
18 # include <osreldate.h>
19 # define ACTUALLY_LKM_NOT_KERNEL
21 # include <sys/osreldate.h>
24 #include <sys/systm.h>
25 #if defined(__FreeBSD_version) && (__FreeBSD_version >= 220000)
26 # include <sys/conf.h>
27 # include <sys/kernel.h>
29 # include <sys/devfsext.h>
34 #if defined(__FreeBSD_version) && (__FreeBSD_version >= 300000)
35 # include <sys/lock.h>
39 #include <sys/kernel.h>
40 #include <sys/vnode.h>
41 #include <sys/namei.h>
42 #include <sys/malloc.h>
43 #include <sys/mount.h>
47 # include <sys/sysctl.h>
49 #if (__FreeBSD_version >= 300000)
50 # include <sys/socket.h>
52 #if (__FreeBSD_version >= 199511)
54 #include <netinet/in_systm.h>
55 #include <netinet/in.h>
56 #include <netinet/ip.h>
57 #include <net/route.h>
58 #include <netinet/ip_var.h>
59 #include <netinet/tcp.h>
60 #include <netinet/tcpip.h>
63 # include <sys/sysent.h>
66 #include "netinet/ip_compat.h"
67 #include "netinet/ip_fil.h"
68 #include "netinet/ip_rules.h"
71 int xxxinit
__P((struct lkm_table
*, int, int));
73 #if !defined(__FreeBSD_version) || (__FreeBSD_version < 220000)
74 MOD_DEV(IPL_VERSION
, LM_DT_CHAR
, -1, &ipldevsw
);
77 static int ipfrule_ioctl
__P((struct lkm_table
*, int));
79 #if defined(__FreeBSD_version) && (__FreeBSD_version < 220000)
81 int xxxinit(lkmtp
, cmd
, ver
)
82 struct lkm_table
*lkmtp
;
85 DISPATCH(lkmtp
, cmd
, ver
, ipfrule_ioctl
, ipfrule_ioctl
, ipfrule_ioctl
);
87 #else /* __FREEBSD_version >= 220000 */
89 # include <sys/exec.h>
91 # if (__FreeBSD_version >= 300000)
97 static struct lkm_misc _module
= {
106 int ipfrule
__P((struct lkm_table
*, int, int));
109 int ipfrule(lkmtp
, cmd
, ver
)
110 struct lkm_table
*lkmtp
;
113 # if (__FreeBSD_version >= 300000)
114 MOD_DISPATCH(ipfrule
, lkmtp
, cmd
, ver
, ipfrule_ioctl
, ipfrule_ioctl
,
117 DISPATCH(lkmtp
, cmd
, ver
, ipfrule_ioctl
, ipfrule_ioctl
, ipfrule_ioctl
);
120 # endif /* IPFILTER_LKM */
123 int ipfrule_load(lkmtp
, cmd
)
124 struct lkm_table
*lkmtp
;
127 return ipfrule_add();
131 int ipfrule_unload(lkmtp
, cmd
)
132 struct lkm_table
*lkmtp
;
135 return ipfrule_remove();
139 static int ipfrule_ioctl(lkmtp
, cmd
)
140 struct lkm_table
*lkmtp
;
148 if (lkmexists(lkmtp
))
151 err
= ipfrule_load(lkmtp
, cmd
);
156 err
= ipfrule_unload(lkmtp
, cmd
);
168 #endif /* _FreeBSD_version */