snj doesn't like my accent, so use proper English month names.
[netbsd-mini2440.git] / dist / ipf / mls_rule.c
blob34c2a1ea875c956b5c2f774be114e35ab15dc273
1 /* $NetBSD$ */
3 /*
4 * Copyright (C) 1993-2001 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
7 */
8 /*
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!
12 #include <sys/types.h>
13 #include <sys/stat.h>
14 #include <sys/time.h>
15 #include <sys/file.h>
16 #include <sys/socket.h>
17 #include <sys/conf.h>
18 #include <sys/syslog.h>
19 #include <sys/buf.h>
20 #include <sys/mbuf.h>
21 #include <sys/param.h>
22 #include <sys/errno.h>
23 #include <sys/uio.h>
24 #include <sys/vnode.h>
25 #include <sundev/mbvar.h>
26 #include <sun/autoconf.h>
27 #include <sun/vddrv.h>
28 #if defined(sun4c) || defined(sun4m)
29 # include <sun/openprom.h>
30 #endif
31 #include <netinet/in.h>
32 #include <netinet/in_systm.h>
33 #include <netinet/ip.h>
34 #include <netinet/ip_var.h>
35 #include <netinet/tcp.h>
36 #include <netinet/tcpip.h>
37 #include <net/if.h>
38 #include "ip_compat.h"
39 #include "ip_fil.h"
40 #include "ip_rules.h"
43 extern int errno;
46 int xxxinit __P((u_int, struct vddrv *, caddr_t, struct vdstat *));
48 int ipl_major = 0;
50 #ifdef sun4m
51 struct vdldrv vd =
53 VDMAGIC_USER,
54 "IP Filter rules",
55 NULL,
56 NULL,
57 NULL,
60 NULL,
61 NULL,
62 NULL,
66 #else /* sun4m */
67 struct vdldrv vd =
69 VDMAGIC_USER, /* magic */
70 "IP Filter rules",
71 #ifdef sun4c
72 NULL, /* dev_ops */
73 #else
74 NULL, /* struct mb_ctlr *mb_ctlr */
75 NULL, /* struct mb_driver *mb_driver */
76 NULL, /* struct mb_device *mb_device */
77 0, /* num ctlrs */
78 1, /* numdevs */
79 #endif /* sun4c */
80 NULL, /* bdevsw */
81 NULL, /* cdevsw */
82 0, /* block major */
83 0, /* char major */
85 #endif /* sun4m */
88 xxxinit(fc, vdp, data, vds)
89 u_int fc;
90 struct vddrv *vdp;
91 caddr_t data;
92 struct vdstat *vds;
94 struct vdioctl_load *vdi = (struct vdioctl_load *)data;
95 int err;
97 switch (fc)
99 case VDLOAD:
100 err = ipfrule_add();
101 if (!err)
102 fr_refcnt++;
103 break;
104 case VDUNLOAD:
105 err = ipfrule_remove();
106 if (!err)
107 fr_refcnt--;
108 break;
109 case VDSTAT:
110 err = 0;
111 break;
112 default:
113 err = EIO;
114 break;