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