Change the kernel dev_t, representing a pointer to a specinfo structure,
[dragonfly.git] / sys / contrib / ipfilter / netinet / ip_fil.h
CommitLineData
984263bc
MD
1/*
2 * Copyright (C) 1993-2002 by Darren Reed.
3 *
4 * See the IPFILTER.LICENCE file for details on licencing.
5 *
6 * @(#)ip_fil.h 1.35 6/5/96
7 * $Id: ip_fil.h,v 2.29.2.33 2002/06/04 14:46:28 darrenr Exp $
91865926 8 * $FreeBSD: src/sys/contrib/ipfilter/netinet/ip_fil.h,v 1.18.2.8 2004/07/05 06:02:35 darrenr Exp $
b13267a5 9 * $DragonFly: src/sys/contrib/ipfilter/netinet/ip_fil.h,v 1.12 2006/09/10 01:26:33 dillon Exp $
984263bc
MD
10 */
11
12#ifndef __IP_FIL_H__
13#define __IP_FIL_H__
14
fef8985e
MD
15#if defined(__DragonFly__)
16#include <sys/device.h>
17#endif
18
984263bc
MD
19/*
20 * Pathnames for various IP Filter control devices. Used by LKM
21 * and userland, so defined here.
22 */
23#define IPNAT_NAME "/dev/ipnat"
24#define IPSTATE_NAME "/dev/ipstate"
25#define IPAUTH_NAME "/dev/ipauth"
26
27#ifndef SOLARIS
28# define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
29#endif
30
31#if defined(KERNEL) && !defined(_KERNEL)
32# define _KERNEL
33#endif
34
984263bc
MD
35#ifndef offsetof
36# define offsetof(t,m) (int)((&((t *)0L)->m))
37#endif
38
39#if defined(__STDC__) || defined(__GNUC__)
40# define SIOCADAFR _IOW('r', 60, struct frentry *)
41# define SIOCRMAFR _IOW('r', 61, struct frentry *)
42# define SIOCSETFF _IOW('r', 62, u_int)
43# define SIOCGETFF _IOR('r', 63, u_int)
44# define SIOCGETFS _IOWR('r', 64, struct friostat *)
45# define SIOCIPFFL _IOWR('r', 65, int)
46# define SIOCIPFFB _IOR('r', 66, int)
47# define SIOCADIFR _IOW('r', 67, struct frentry *)
48# define SIOCRMIFR _IOW('r', 68, struct frentry *)
49# define SIOCSWAPA _IOR('r', 69, u_int)
50# define SIOCINAFR _IOW('r', 70, struct frentry *)
51# define SIOCINIFR _IOW('r', 71, struct frentry *)
52# define SIOCFRENB _IOW('r', 72, u_int)
53# define SIOCFRSYN _IOW('r', 73, u_int)
54# define SIOCFRZST _IOWR('r', 74, struct friostat *)
55# define SIOCZRLST _IOWR('r', 75, struct frentry *)
56# define SIOCAUTHW _IOWR('r', 76, struct frauth *)
57# define SIOCAUTHR _IOWR('r', 77, struct frauth *)
58# define SIOCATHST _IOWR('r', 78, struct fr_authstat *)
59# define SIOCSTLCK _IOWR('r', 79, u_int)
60# define SIOCSTPUT _IOWR('r', 80, struct ipstate_save *)
61# define SIOCSTGET _IOWR('r', 81, struct ipstate_save *)
62# define SIOCSTGSZ _IOWR('r', 82, struct natget)
63# define SIOCGFRST _IOWR('r', 83, struct ipfrstat *)
64# define SIOCIPFL6 _IOWR('r', 84, int)
65#else
66# define SIOCADAFR _IOW(r, 60, struct frentry *)
67# define SIOCRMAFR _IOW(r, 61, struct frentry *)
68# define SIOCSETFF _IOW(r, 62, u_int)
69# define SIOCGETFF _IOR(r, 63, u_int)
70# define SIOCGETFS _IOWR(r, 64, struct friostat *)
71# define SIOCIPFFL _IOWR(r, 65, int)
72# define SIOCIPFFB _IOR(r, 66, int)
73# define SIOCADIFR _IOW(r, 67, struct frentry *)
74# define SIOCRMIFR _IOW(r, 68, struct frentry *)
75# define SIOCSWAPA _IOR(r, 69, u_int)
76# define SIOCINAFR _IOW(r, 70, struct frentry *)
77# define SIOCINIFR _IOW(r, 71, struct frentry *)
78# define SIOCFRENB _IOW(r, 72, u_int)
79# define SIOCFRSYN _IOW(r, 73, u_int)
80# define SIOCFRZST _IOWR(r, 74, struct friostat *)
81# define SIOCZRLST _IOWR(r, 75, struct frentry *)
82# define SIOCAUTHW _IOWR(r, 76, struct frauth *)
83# define SIOCAUTHR _IOWR(r, 77, struct frauth *)
84# define SIOCATHST _IOWR(r, 78, struct fr_authstat *)
85# define SIOCSTLCK _IOWR(r, 79, u_int)
86# define SIOCSTPUT _IOWR(r, 80, struct ipstate_save *)
87# define SIOCSTGET _IOWR(r, 81, struct ipstate_save *)
88# define SIOCSTGSZ _IOWR(r, 82, struct natget)
89# define SIOCGFRST _IOWR(r, 83, struct ipfrstat *)
90# define SIOCIPFL6 _IOWR(r, 84, int)
91#endif
92#define SIOCADDFR SIOCADAFR
93#define SIOCDELFR SIOCRMAFR
94#define SIOCINSFR SIOCINAFR
95
96
97typedef struct fr_ip {
98 u_32_t fi_v:4; /* IP version */
99 u_32_t fi_fl:4; /* packet flags */
100 u_32_t fi_tos:8; /* IP packet TOS */
101 u_32_t fi_ttl:8; /* IP packet TTL */
102 u_32_t fi_p:8; /* IP packet protocol */
103 union i6addr fi_src; /* source address from packet */
104 union i6addr fi_dst; /* destination address from packet */
105 u_32_t fi_optmsk; /* bitmask composed from IP options */
106 u_short fi_secmsk; /* bitmask composed from IP security options */
107 u_short fi_auth; /* authentication code from IP sec. options */
108} fr_ip_t;
109
110#define FI_OPTIONS (FF_OPTIONS >> 24)
111#define FI_TCPUDP (FF_TCPUDP >> 24) /* TCP/UCP implied comparison*/
112#define FI_FRAG (FF_FRAG >> 24)
113#define FI_SHORT (FF_SHORT >> 24)
114#define FI_CMP (FI_OPTIONS|FI_TCPUDP|FI_SHORT)
115
116#define fi_saddr fi_src.in4.s_addr
117#define fi_daddr fi_dst.in4.s_addr
118
119
120/*
121 * These are both used by the state and NAT code to indicate that one port or
122 * the other should be treated as a wildcard.
123 */
124#define FI_W_SPORT 0x00000100
125#define FI_W_DPORT 0x00000200
126#define FI_WILDP (FI_W_SPORT|FI_W_DPORT)
127#define FI_W_SADDR 0x00000400
128#define FI_W_DADDR 0x00000800
129#define FI_WILDA (FI_W_SADDR|FI_W_DADDR)
130#define FI_NEWFR 0x00001000 /* Create a filter rule */
131#define FI_IGNOREPKT 0x00002000 /* Do not treat as a real packet */
132#define FI_NORULE 0x00004000 /* Not direct a result of a rule */
133
134typedef struct fr_info {
135 void *fin_ifp; /* interface packet is `on' */
136 struct fr_ip fin_fi; /* IP Packet summary */
137 u_short fin_data[2]; /* TCP/UDP ports, ICMP code/type */
138 u_int fin_out; /* in or out ? 1 == out, 0 == in */
139 u_short fin_hlen; /* length of IP header in bytes */
140 u_char fin_rev; /* state only: 1 = reverse */
141 u_char fin_tcpf; /* TCP header flags (SYN, ACK, etc) */
142 u_int fin_icode; /* ICMP error to return */
143 u_32_t fin_rule; /* rule # last matched */
144 u_32_t fin_group; /* group number, -1 for none */
145 struct frentry *fin_fr; /* last matching rule */
146 char *fin_dp; /* start of data past IP header */
147 u_short fin_plen;
148 u_short fin_off;
149 u_short fin_dlen; /* length of data portion of packet */
150 u_short fin_id; /* IP packet id field */
151 u_int fin_misc;
91865926 152 mb_t **fin_mp; /* pointer to pointer to mbuf */
984263bc
MD
153#if SOLARIS
154 void *fin_qfm; /* pointer to mblk where pkt starts */
155 void *fin_qif;
156#endif
157} fr_info_t;
158
159#define fin_v fin_fi.fi_v
160#define fin_p fin_fi.fi_p
161#define fin_saddr fin_fi.fi_saddr
162#define fin_src fin_fi.fi_src.in4
163#define fin_daddr fin_fi.fi_daddr
164#define fin_dst fin_fi.fi_dst.in4
165#define fin_fl fin_fi.fi_fl
166
167/*
168 * Size for compares on fr_info structures
169 */
170#define FI_CSIZE offsetof(fr_info_t, fin_icode)
171#define FI_LCSIZE offsetof(fr_info_t, fin_dp)
172
173/*
174 * For fin_misc
175 */
176#define FM_BADSTATE 0x00000001
177
178/*
179 * Size for copying cache fr_info structure
180 */
181#define FI_COPYSIZE offsetof(fr_info_t, fin_dp)
182
183typedef struct frdest {
184 void *fd_ifp;
185 union i6addr fd_ip6;
186 char fd_ifname[LIFNAMSIZ];
187#if SOLARIS
188 mb_t *fd_mp; /* cache resolver for to/dup-to */
189#endif
190} frdest_t;
191
192#define fd_ip fd_ip6.in4
193
194
195typedef struct frpcmp {
196 int frp_cmp; /* data for port comparisons */
197 u_short frp_port; /* top port for <> and >< */
198 u_short frp_top; /* top port for <> and >< */
199} frpcmp_t;
200
201typedef struct frtuc {
202 u_char ftu_tcpfm; /* tcp flags mask */
203 u_char ftu_tcpf; /* tcp flags */
204 frpcmp_t ftu_src;
205 frpcmp_t ftu_dst;
206} frtuc_t;
207
208#define ftu_scmp ftu_src.frp_cmp
209#define ftu_dcmp ftu_dst.frp_cmp
210#define ftu_sport ftu_src.frp_port
211#define ftu_dport ftu_dst.frp_port
212#define ftu_stop ftu_src.frp_top
213#define ftu_dtop ftu_dst.frp_top
214
215typedef struct frentry {
216 struct frentry *fr_next;
217 struct frentry *fr_grp;
218 int fr_ref; /* reference count - for grouping */
219 void *fr_ifas[4];
220 /*
221 * These are only incremented when a packet matches this rule and
222 * it is the last match
223 */
224 U_QUAD_T fr_hits;
225 U_QUAD_T fr_bytes;
226 /*
227 * Fields after this may not change whilst in the kernel.
228 */
229 struct fr_ip fr_ip;
230 struct fr_ip fr_mip; /* mask structure */
231
232
233 u_short fr_icmpm; /* data for ICMP packets (mask) */
234 u_short fr_icmp;
235
236 u_int fr_age[2]; /* aging for state */
237 frtuc_t fr_tuc;
238 u_32_t fr_group; /* group to which this rule belongs */
239 u_32_t fr_grhead; /* group # which this rule starts */
240 u_32_t fr_flags; /* per-rule flags && options (see below) */
241 u_int fr_skip; /* # of rules to skip */
242 u_int fr_loglevel; /* syslog log facility + priority */
6e09358b 243 int (*fr_func) (int, ip_t *, fr_info_t *); /* call this function */
984263bc
MD
244 int fr_sap; /* For solaris only */
245 u_char fr_icode; /* return ICMP code */
246 char fr_ifnames[4][LIFNAMSIZ];
247 struct frdest fr_tif; /* "to" interface */
248 struct frdest fr_dif; /* duplicate packet interfaces */
249 u_int fr_cksum; /* checksum on filter rules for performance */
250} frentry_t;
251
252#define fr_v fr_ip.fi_v
253#define fr_proto fr_ip.fi_p
254#define fr_ttl fr_ip.fi_ttl
255#define fr_tos fr_ip.fi_tos
256#define fr_tcpfm fr_tuc.ftu_tcpfm
257#define fr_tcpf fr_tuc.ftu_tcpf
258#define fr_scmp fr_tuc.ftu_scmp
259#define fr_dcmp fr_tuc.ftu_dcmp
260#define fr_dport fr_tuc.ftu_dport
261#define fr_sport fr_tuc.ftu_sport
262#define fr_stop fr_tuc.ftu_stop
263#define fr_dtop fr_tuc.ftu_dtop
264#define fr_dst fr_ip.fi_dst.in4
265#define fr_src fr_ip.fi_src.in4
266#define fr_dmsk fr_mip.fi_dst.in4
267#define fr_smsk fr_mip.fi_src.in4
268#define fr_ifname fr_ifnames[0]
269#define fr_oifname fr_ifnames[2]
270#define fr_ifa fr_ifas[0]
271#define fr_oifa fr_ifas[2]
272
273#define FR_CMPSIZ (sizeof(struct frentry) - offsetof(frentry_t, fr_ip))
274
275/*
276 * fr_flags
277 */
278#define FR_BLOCK 0x00001 /* do not allow packet to pass */
279#define FR_PASS 0x00002 /* allow packet to pass */
280#define FR_OUTQUE 0x00004 /* outgoing packets */
281#define FR_INQUE 0x00008 /* ingoing packets */
282#define FR_LOG 0x00010 /* Log */
283#define FR_LOGB 0x00011 /* Log-fail */
284#define FR_LOGP 0x00012 /* Log-pass */
285#define FR_NOTSRCIP 0x00020 /* not the src IP# */
286#define FR_NOTDSTIP 0x00040 /* not the dst IP# */
287#define FR_RETRST 0x00080 /* Return TCP RST packet - reset connection */
288#define FR_RETICMP 0x00100 /* Return ICMP unreachable packet */
289#define FR_FAKEICMP 0x00180 /* Return ICMP unreachable with fake source */
290#define FR_NOMATCH 0x00200 /* no match occured */
291#define FR_ACCOUNT 0x00400 /* count packet bytes */
292#define FR_KEEPFRAG 0x00800 /* keep fragment information */
293#define FR_KEEPSTATE 0x01000 /* keep `connection' state information */
294#define FR_INACTIVE 0x02000
295#define FR_QUICK 0x04000 /* match & stop processing list */
296#define FR_FASTROUTE 0x08000 /* bypass normal routing */
297#define FR_CALLNOW 0x10000 /* call another function (fr_func) if matches */
298#define FR_DUP 0x20000 /* duplicate packet */
299#define FR_LOGORBLOCK 0x40000 /* block the packet if it can't be logged */
300#define FR_LOGBODY 0x80000 /* Log the body */
301#define FR_LOGFIRST 0x100000 /* Log the first byte if state held */
302#define FR_AUTH 0x200000 /* use authentication */
303#define FR_PREAUTH 0x400000 /* require preauthentication */
304#define FR_DONTCACHE 0x800000 /* don't cache the result */
305
306#define FR_LOGMASK (FR_LOG|FR_LOGP|FR_LOGB)
307#define FR_RETMASK (FR_RETICMP|FR_RETRST|FR_FAKEICMP)
308
309/*
310 * These correspond to #define's for FI_* and are stored in fr_flags
311 */
312#define FF_OPTIONS 0x01000000
313#define FF_TCPUDP 0x02000000
314#define FF_FRAG 0x04000000
315#define FF_SHORT 0x08000000
316/*
317 * recognized flags for SIOCGETFF and SIOCSETFF, and get put in fr_flags
318 */
319#define FF_LOGPASS 0x10000000
320#define FF_LOGBLOCK 0x20000000
321#define FF_LOGNOMATCH 0x40000000
322#define FF_LOGGING (FF_LOGPASS|FF_LOGBLOCK|FF_LOGNOMATCH)
323#define FF_BLOCKNONIP 0x80000000 /* Solaris2 Only */
324
325#define FR_NONE 0
326#define FR_EQUAL 1
327#define FR_NEQUAL 2
328#define FR_LESST 3
329#define FR_GREATERT 4
330#define FR_LESSTE 5
331#define FR_GREATERTE 6
332#define FR_OUTRANGE 7
333#define FR_INRANGE 8
334
335typedef struct filterstats {
336 u_long fr_pass; /* packets allowed */
337 u_long fr_block; /* packets denied */
338 u_long fr_nom; /* packets which don't match any rule */
339 u_long fr_short; /* packets which are short */
340 u_long fr_ppkl; /* packets allowed and logged */
341 u_long fr_bpkl; /* packets denied and logged */
342 u_long fr_npkl; /* packets unmatched and logged */
343 u_long fr_pkl; /* packets logged */
344 u_long fr_skip; /* packets to be logged but buffer full */
345 u_long fr_ret; /* packets for which a return is sent */
346 u_long fr_acct; /* packets for which counting was performed */
347 u_long fr_bnfr; /* bad attempts to allocate fragment state */
348 u_long fr_nfr; /* new fragment state kept */
349 u_long fr_cfr; /* add new fragment state but complete pkt */
350 u_long fr_bads; /* bad attempts to allocate packet state */
351 u_long fr_ads; /* new packet state kept */
352 u_long fr_chit; /* cached hit */
353 u_long fr_tcpbad; /* TCP checksum check failures */
354 u_long fr_pull[2]; /* good and bad pullup attempts */
355 u_long fr_badsrc; /* source received doesn't match route */
356 u_long fr_badttl; /* TTL in packet doesn't reach minimum */
357#if SOLARIS
358 u_long fr_notdata; /* PROTO/PCPROTO that have no data */
359 u_long fr_nodata; /* mblks that have no data */
360 u_long fr_bad; /* bad IP packets to the filter */
361 u_long fr_notip; /* packets passed through no on ip queue */
362 u_long fr_drop; /* packets dropped - no info for them! */
363 u_long fr_copy; /* messages copied due to db_ref > 1 */
364#endif
365 u_long fr_ipv6[2]; /* IPv6 packets in/out */
366} filterstats_t;
367
368/*
369 * For SIOCGETFS
370 */
371typedef struct friostat {
372 struct filterstats f_st[2];
373 struct frentry *f_fin[2];
374 struct frentry *f_fout[2];
375 struct frentry *f_acctin[2];
376 struct frentry *f_acctout[2];
377 struct frentry *f_fin6[2];
378 struct frentry *f_fout6[2];
379 struct frentry *f_acctin6[2];
380 struct frentry *f_acctout6[2];
381 struct frentry *f_auth;
382 struct frgroup *f_groups[3][2];
383 u_long f_froute[2];
384 int f_defpass; /* default pass - from fr_pass */
385 char f_active; /* 1 or 0 - active rule set */
386 char f_running; /* 1 if running, else 0 */
387 char f_logging; /* 1 if enabled, else 0 */
388 char f_version[32]; /* version string */
389 int f_locks[4];
390} friostat_t;
391
392typedef struct optlist {
393 u_short ol_val;
394 int ol_bit;
395} optlist_t;
396
397
398/*
399 * Group list structure.
400 */
401typedef struct frgroup {
402 u_32_t fg_num;
403 struct frgroup *fg_next;
404 struct frentry *fg_head;
405 struct frentry **fg_start;
406} frgroup_t;
407
408
409/*
410 * Log structure. Each packet header logged is prepended by one of these.
411 * Following this in the log records read from the device will be an ipflog
412 * structure which is then followed by any packet data.
413 */
414typedef struct iplog {
415 u_32_t ipl_magic;
416 u_int ipl_count;
417 struct timeval ipl_tv;
418 size_t ipl_dsize;
419 struct iplog *ipl_next;
420} iplog_t;
421
422#define ipl_sec ipl_tv.tv_sec
423#define ipl_usec ipl_tv.tv_usec
424
425#define IPL_MAGIC 0x49504c4d /* 'IPLM' */
426#define IPLOG_SIZE sizeof(iplog_t)
427
428typedef struct ipflog {
429#if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199603)) || \
d704cf85 430 (defined(OpenBSD) && (OpenBSD >= 199603)) || defined(__DragonFly__)
984263bc
MD
431 char fl_ifname[LIFNAMSIZ];
432#else
433 u_int fl_unit;
434 char fl_ifname[LIFNAMSIZ];
435#endif
436 u_char fl_plen; /* extra data after hlen */
437 u_char fl_hlen; /* length of IP headers saved */
438 u_short fl_loglevel; /* syslog log level */
439 u_32_t fl_rule;
440 u_32_t fl_group;
441 u_32_t fl_flags;
442 u_char fl_dir;
443 u_char fl_pad[3];
444} ipflog_t;
445
446
447#ifndef ICMP_UNREACH_FILTER
448# define ICMP_UNREACH_FILTER 13
449#endif
450
451#ifndef IPF_LOGGING
452# define IPF_LOGGING 0
453#endif
454#ifndef IPF_DEFAULT_PASS
455# define IPF_DEFAULT_PASS FR_PASS
456#endif
457
458#define IPMINLEN(i, h) ((i)->ip_len >= ((i)->ip_hl * 4 + sizeof(struct h)))
459#define IPLLOGSIZE 8192
460
461#define IPF_OPTCOPY 0x07ff00 /* bit mask of copied options */
462
463/*
464 * Device filenames for reading log information. Use ipf on Solaris2 because
465 * ipl is already a name used by something else.
466 */
467#ifndef IPL_NAME
468# if SOLARIS
469# define IPL_NAME "/dev/ipf"
470# else
471# define IPL_NAME "/dev/ipl"
472# endif
473#endif
474#define IPL_NAT IPNAT_NAME
475#define IPL_STATE IPSTATE_NAME
476#define IPL_AUTH IPAUTH_NAME
477
478#define IPL_LOGIPF 0 /* Minor device #'s for accessing logs */
479#define IPL_LOGNAT 1
480#define IPL_LOGSTATE 2
481#define IPL_LOGAUTH 3
482#define IPL_LOGMAX 3
483
715fc6d8
JS
484#if !defined(CDEV_MAJOR) && (defined(__DragonFly__) || \
485 (defined (__FreeBSD_version) && __FreeBSD_version >= 220000))
984263bc
MD
486# define CDEV_MAJOR 79
487#endif
488
489/*
490 * Post NetBSD 1.2 has the PFIL interface for packet filters. This turns
491 * on those hooks. We don't need any special mods in non-IP Filter code
492 * with this!
493 */
494#if (defined(NetBSD) && (NetBSD > 199609) && (NetBSD <= 1991011)) || \
e7e55f42
JR
495 (defined(NetBSD1_2) && NetBSD1_2 > 1) || (__DragonFly_version >= 100000)
496# if (NetBSD >= 199905) || (__DragonFly_version >= 100000)
984263bc
MD
497# define PFIL_HOOKS
498# endif
499# ifdef PFIL_HOOKS
500# define NETBSD_PF
501# endif
502#endif
503
504
505#ifndef _KERNEL
b13267a5 506
984263bc 507struct ifnet;
b13267a5
MD
508struct cdev;
509
6e09358b
RG
510extern char *get_ifname (struct ifnet *);
511extern int fr_check (ip_t *, int, void *, int, mb_t **);
512extern int (*fr_checkp) (ip_t *, int, void *, int, mb_t **);
513extern int send_reset (ip_t *, fr_info_t *);
514extern int send_icmp_err (ip_t *, int, fr_info_t *, int);
515extern int ipf_log (void);
516extern struct ifnet *get_unit (char *, int);
517extern int mbuflen (mb_t *);
b13267a5
MD
518extern int iplioctl (struct cdev *, u_long, caddr_t, int);
519extern int iplopen (struct cdev *, int);
520extern int iplclose (struct cdev *, int);
521
522#else /* !_KERNEL */
523
984263bc 524# if defined(__NetBSD__) && defined(PFIL_HOOKS)
6e09358b 525extern void ipfilterattach (int);
984263bc 526# endif
6e09358b
RG
527extern int iplattach (void);
528extern int ipl_enable (void);
529extern int ipl_disable (void);
530extern int send_icmp_err (ip_t *, int, fr_info_t *, int);
531extern int send_reset (ip_t *, fr_info_t *);
6e09358b
RG
532extern int fr_check (ip_t *, int, void *, int, mb_t **);
533extern int (*fr_checkp) (ip_t *, int, void *, int, mb_t **);
534extern int ipfr_fastroute (mb_t *, mb_t **, fr_info_t *, frdest_t *);
535extern size_t mbufchainlen (mb_t *);
984263bc 536# ifdef IPFILTER_LKM
6e09358b 537extern int iplidentify (char *);
984263bc 538# endif
fef8985e
MD
539extern d_ioctl_t iplioctl;
540extern d_open_t iplopen;
541extern d_close_t iplclose;
fef8985e 542extern d_read_t iplread;
b13267a5 543
984263bc
MD
544#endif /* #ifndef _KERNEL */
545
6e09358b
RG
546extern char *memstr (char *, char *, int, int);
547extern void fixskip (frentry_t **, frentry_t *, int);
548extern int countbits (u_32_t);
549extern int ipldetach (void);
550extern u_short ipf_cksum (u_short *, int);
551extern int ircopyptr (void *, void *, size_t);
552extern int iwcopyptr (void *, void *, size_t);
553
554extern void ipflog_init (void);
555extern int ipflog_clear (minor_t);
556extern int ipflog (u_int, ip_t *, fr_info_t *, mb_t *);
557extern int ipllog (int, fr_info_t *, void **, size_t *, int *, int);
558extern int ipflog_read (minor_t, struct uio *);
559
560extern int frflush (minor_t, int, int);
561extern void frsync (void);
562extern frgroup_t *fr_addgroup (u_32_t, frentry_t *, minor_t, int);
563extern void fr_delgroup (u_32_t, u_32_t, minor_t, int);
564extern frgroup_t *fr_findgroup (u_32_t, u_32_t, minor_t, int,
565 frgroup_t ***);
566
567extern int fr_copytolog (int, char *, int);
568extern void fr_forgetifp (void *);
569extern void fr_getstat (struct friostat *);
570extern int fr_ifpaddr (int, void *, struct in_addr *);
571extern int fr_lock (caddr_t, int *);
91865926 572extern int fr_makefrip (int, ip_t *, fr_info_t *);
6e09358b
RG
573extern u_short fr_tcpsum (mb_t *, ip_t *, tcphdr_t *);
574extern int fr_scanlist (u_32_t, ip_t *, fr_info_t *, void *);
575extern int fr_tcpudpchk (frtuc_t *, fr_info_t *);
576extern int fr_verifysrc (struct in_addr, void *);
984263bc
MD
577
578extern int ipl_unreach;
579extern int fr_running;
580extern u_long ipl_frouteok[2];
581extern int fr_pass;
582extern int fr_flags;
583extern int fr_active;
584extern int fr_chksrc;
585extern int fr_minttl;
586extern int fr_minttllog;
587extern fr_info_t frcache[2];
588extern char ipfilter_version[];
589extern iplog_t **iplh[IPL_LOGMAX+1], *iplt[IPL_LOGMAX+1];
590extern size_t iplused[IPL_LOGMAX + 1];
591extern struct frentry *ipfilter[2][2], *ipacct[2][2];
592#ifdef USE_INET6
593extern struct frentry *ipfilter6[2][2], *ipacct6[2][2];
594extern int icmptoicmp6types[ICMP_MAXTYPE+1];
595extern int icmptoicmp6unreach[ICMP_MAX_UNREACH];
596#endif
597extern struct frgroup *ipfgroups[3][2];
598extern struct filterstats frstats[];
599
600#endif /* __IP_FIL_H__ */