Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / ipf / mlh_rule.c
blobe71c7be1c0b707b052000733e34223fc3c25ab7e
1 /* $NetBSD$ */
3 /*
4 * Copyright (C) 1993-1998 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
8 */
9 /* #pragma ident "@(#)solaris.c 1.12 6/5/96 (C) 1995 Darren Reed"*/
11 /*typedef unsigned int spustate_t;*/
12 struct uio;
14 #include <sys/types.h>
15 #include <sys/cmn_err.h>
16 #include <sys/kernel.h>
17 #include <sys/systm.h>
18 #include <sys/malloc.h>
19 #include <sys/conf.h>
20 #include <sys/callout.h>
21 #include <sys/moddefs.h>
22 #include <sys/io.h>
23 #include <sys/wsio.h>
24 #include <sys/param.h>
25 #include <sys/errno.h>
26 #include <sys/byteorder.h>
27 #include <sys/socket.h>
28 #include <sys/stropts.h>
29 #include <net/if.h>
30 #include <net/af.h>
31 #include <net/route.h>
32 #include <netinet/in.h>
33 #include <netinet/in_systm.h>
34 #include <netinet/if_ether.h>
35 #include <netinet/ip.h>
36 #include <netinet/ip_var.h>
37 #include <netinet/tcp.h>
38 #include <netinet/udp.h>
39 #include <netinet/tcpip.h>
40 #include <netinet/ip_icmp.h>
42 #include "ip_compat.h"
43 #include "ip_fil.h"
44 #include "ip_rules.h"
48 * Driver Header
50 static drv_info_t ipf_drv_info = {
51 "IP Filter Rules", /* type */
52 "pseudo", /* class */
53 DRV_PSEUDO|DRV_SAVE_CONF|DRV_MP_SAFE, /* flags */
54 -1, /* b_major */
55 -1, /* c_major */
56 NULL, /* cdio */
57 NULL, /* gio_private */
58 NULL, /* cdio_private */
62 extern struct mod_operations gio_mod_ops;
63 static drv_info_t ipf_drv_info;
64 extern struct mod_conf_data ipf_conf_data;
66 static struct mod_type_data ipf_drv_link = {
67 IPL_VERSION, (void *)NULL
70 static struct modlink ipf_mod_link[] = {
71 { &gio_mod_ops, (void *)&ipf_drv_link },
72 { NULL, (void *)NULL }
75 struct modwrapper ipf_wrapper = {
76 MODREV,
77 ipf_load,
78 ipf_unload,
79 (void (*)())NULL,
80 (void *)&ipf_conf_data,
81 ipf_mod_link
85 static int ipf_load(void *arg)
87 int i;
89 i = ipfrule_add();
90 if (!i)
91 fr_refcnt--;
92 #ifdef IPFDEBUG
93 printf("IP Filter Rules: ipfrule_add() = %d\n", i);
94 #endif
95 if (!i)
96 cmn_err(CE_CONT, "IP Filter Rules: Loaded\n");
97 return i;
101 static int ipf_unload(void *arg)
103 int i;
105 i = ipfrule_remove();
106 if (!i)
107 fr_refcnt--;
108 #ifdef IPFDEBUG
109 printf("IP Filter Rules: ipfrule_remove() = %d\n", i);
110 #endif
111 if (!i)
112 cmn_err(CE_CONT, "IP Filter Rules: Unloaded\n");
113 return i;