Deleted Added
sdiff udiff text old ( 72006 ) new ( 80482 )
full compact
1/*
2 * Copyright (C) 1993-2001 by Darren Reed.
3 *
4 * See the IPFILTER.LICENCE file for details on licencing.
5 *
6 * @(#)ip_compat.h 1.8 1/14/96
7 * $Id: ip_compat.h,v 2.26.2.9 2001/01/14 14:58:01 darrenr Exp $
8 * $FreeBSD: head/sys/contrib/ipfilter/netinet/ip_compat.h 80482 2001-07-28 11:58:26Z darrenr $
9 */
10
11#ifndef __IP_COMPAT_H__
12#define __IP_COMPAT_H__
13
14#ifndef __P
15# ifdef __STDC__
16# define __P(x) x

--- 4 unchanged lines hidden (view full) ---

21#ifndef __STDC__
22# undef const
23# define const
24#endif
25
26#ifndef SOLARIS
27#define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
28#endif
29#if SOLARIS && !defined(SOLARIS2)
30# define SOLARIS2 4 /* Pick an old version */
31#endif
32#if SOLARIS2 >= 8
33# ifndef USE_INET6
34# define USE_INET6
35# endif
36#endif
37
38#if defined(_KERNEL) || defined(KERNEL) || defined(__KERNEL__)
39# undef KERNEL

--- 76 unchanged lines hidden (view full) ---

116# include <inet/ip_if.h>
117# include <netinet/ip6.h>
118# define ipif_local_addr ipif_lcl_addr
119/* Only defined in private include file */
120# ifndef V4_PART_OF_V6
121# define V4_PART_OF_V6(v6) v6.s6_addr32[3]
122# endif
123# endif
124
125typedef struct qif {
126 struct qif *qf_next;
127 ill_t *qf_ill;
128 kmutex_t qf_lock;
129 void *qf_iptr;
130 void *qf_optr;
131 queue_t *qf_in;
132 queue_t *qf_out;
133 struct qinit *qf_wqinfo;
134 struct qinit *qf_rqinfo;
135 struct qinit qf_wqinit;
136 struct qinit qf_rqinit;
137 mblk_t *qf_m; /* These three fields are for passing data up from */
138 queue_t *qf_q; /* fr_qin and fr_qout to the packet processing. */
139 size_t qf_off;
140 size_t qf_len; /* this field is used for in ipfr_fastroute */
141 char qf_name[8];
142 /*
143 * in case the ILL has disappeared...
144 */
145 size_t qf_hl; /* header length */
146 int qf_sap;
147} qif_t;
148#else /* SOLARIS */
149# if !defined(__sgi)
150typedef int minor_t;
151# endif
152#endif /* SOLARIS */
153#define IPMINLEN(i, h) ((i)->ip_len >= ((i)->ip_hl * 4 + sizeof(struct h)))
154
155#if defined(__FreeBSD__) && (__FreeBSD__ >= 5) && defined(_KERNEL)
156# include <machine/in_cksum.h>
157#endif
158
159#ifndef IP_OFFMASK

--- 125 unchanged lines hidden (view full) ---

285#define IPOPT_VISA 142 /* VISA */
286#define IPOPT_IMITD 144 /* IMITD */
287#define IPOPT_EIP 145 /* EIP */
288#define IPOPT_FINN 205 /* FINN */
289
290
291#if defined(__FreeBSD__) && (defined(KERNEL) || defined(_KERNEL))
292# ifdef IPFILTER_LKM
293# ifndef __FreeBSD_cc_version
294# include <osreldate.h>
295# else
296# if __FreeBSD_cc_version < 430000
297# include <osreldate.h>
298# else
299# include <sys/param.h>
300# endif
301# endif
302# define ACTUALLY_LKM_NOT_KERNEL
303# else
304# ifndef __FreeBSD_cc_version
305# include <sys/osreldate.h>
306# else
307# if __FreeBSD_cc_version < 430000
308# include <sys/osreldate.h>
309# else
310# include <sys/param.h>
311# endif
312# endif
313# endif
314# if __FreeBSD__ < 3
315# include <machine/spl.h>
316# else
317# if __FreeBSD__ == 3
318# if defined(IPFILTER_LKM) && !defined(ACTUALLY_LKM_NOT_KERNEL)
319# define ACTUALLY_LKM_NOT_KERNEL
320# endif

--- 41 unchanged lines hidden (view full) ---

362# endif
363# define ATOMIC_INC64(x) atomic_add_64((uint64_t*)&(x), 1)
364# define ATOMIC_INC32(x) atomic_add_32((uint32_t*)&(x), 1)
365# define ATOMIC_INC16(x) atomic_add_16((uint16_t*)&(x), 1)
366# define ATOMIC_DEC64(x) atomic_add_64((uint64_t*)&(x), -1)
367# define ATOMIC_DEC32(x) atomic_add_32((uint32_t*)&(x), -1)
368# define ATOMIC_DEC16(x) atomic_add_16((uint16_t*)&(x), -1)
369# else
370# define IRE_CACHE IRE_ROUTE
371# define ATOMIC_INC(x) { mutex_enter(&ipf_rw); (x)++; \
372 mutex_exit(&ipf_rw); }
373# define ATOMIC_DEC(x) { mutex_enter(&ipf_rw); (x)--; \
374 mutex_exit(&ipf_rw); }
375# endif
376# define MUTEX_ENTER(x) mutex_enter(x)
377# if 1
378# define KRWLOCK_T krwlock_t

--- 33 unchanged lines hidden (view full) ---

412# define ntohs(x) (x)
413# define ntohl(x) (x)
414# define htons(x) (x)
415# define htonl(x) (x)
416# endif /* sparc */
417# define KMALLOC(a,b) (a) = (b)kmem_alloc(sizeof(*(a)), KM_NOSLEEP)
418# define KMALLOCS(a,b,c) (a) = (b)kmem_alloc((c), KM_NOSLEEP)
419# define GET_MINOR(x) getminor(x)
420extern ill_t *get_unit __P((char *, int));
421# define GETUNIT(n, v) get_unit(n, v)
422# define IFNAME(x) ((ill_t *)x)->ill_name
423# else /* SOLARIS */
424# if defined(__sgi)
425# define ATOMIC_INC(x) { MUTEX_ENTER(&ipf_rw); \
426 (x)++; MUTEX_EXIT(&ipf_rw); }
427# define ATOMIC_DEC(x) { MUTEX_ENTER(&ipf_rw); \

--- 39 unchanged lines hidden (view full) ---

467# endif
468# else
469# ifndef linux
470# define GETUNIT(n, v) ifunit(n)
471# if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199606)) || \
472 (defined(OpenBSD) && (OpenBSD >= 199603))
473# define IFNAME(x) ((struct ifnet *)x)->if_xname
474# else
475# define USE_GETIFNAME 1
476# define IFNAME(x) get_ifname((struct ifnet *)x)
477extern char *get_ifname __P((struct ifnet *));
478# endif
479# endif
480# endif /* sun */
481
482# if defined(sun) && !defined(linux) || defined(__sgi)
483# define UIOMOVE(a,b,c,d) uiomove((caddr_t)a,b,c,d)
484# define SLEEP(id, n) sleep((id), PZERO+1)
485# define WAKEUP(id) wakeup(id)

--- 39 unchanged lines hidden (view full) ---

525# define KMALLOCS(a, b, c) MALLOC((a), b, (c), M_TEMP, M_NOWAIT)
526# define KFREE(x) FREE((x), M_TEMP)
527# define KFREES(x,s) FREE((x), M_TEMP)
528# endif /* M_PFIL */
529# define UIOMOVE(a,b,c,d) uiomove(a,b,d)
530# define SLEEP(id, n) tsleep((id), PPAUSE|PCATCH, n, 0)
531# define WAKEUP(id) wakeup(id)
532# endif /* BSD */
533# if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199407)) || \
534 (defined(OpenBSD) && (OpenBSD >= 200006))
535# define SPL_NET(x) x = splsoftnet()
536# define SPL_X(x) (void) splx(x)
537# else
538# if !SOLARIS && !defined(linux)
539# define SPL_IMP(x) x = splimp()
540# define SPL_NET(x) x = splnet()
541# define SPL_X(x) (void) splx(x)
542# endif
543# endif /* NetBSD && (NetBSD <= 1991011) && (NetBSD >= 199407) */
544# define PANIC(x,y) if (x) panic y
545#else /* KERNEL */
546# define SLEEP(x,y) ;
547# define WAKEUP(x) ;
548# define PANIC(x,y) ;
549# define ATOMIC_INC(x) (x)++
550# define ATOMIC_DEC(x) (x)--
551# define MUTEX_ENTER(x) ;

--- 42 unchanged lines hidden (view full) ---

594# else
595typedef struct sk_buff mb_t;
596# endif
597# else
598typedef struct mbuf mb_t;
599# endif
600#endif /* SOLARIS */
601
602/*
603 * These #ifdef's are here mainly for linux, but who knows, they may
604 * not be in other places or maybe one day linux will grow up and some
605 * of these will turn up there too.
606 */
607#ifndef ICMP_MINLEN
608# define ICMP_MINLEN 8
609#endif

--- 22 unchanged lines hidden (view full) ---

632# define ICMP_IREQREPLY ICMP_INFO_REPLY
633#endif
634#ifndef ICMP_MASKREQ
635# define ICMP_MASKREQ ICMP_ADDRESS
636#endif
637#ifndef ICMP_MASKREPLY
638# define ICMP_MASKREPLY ICMP_ADDRESSREPLY
639#endif
640#ifndef ICMP_PARAMPROB_OPTABSENT
641# define ICMP_PARAMPROB_OPTABSENT 1
642#endif
643#ifndef IPVERSION
644# define IPVERSION 4
645#endif
646#ifndef IPOPT_MINOFF
647# define IPOPT_MINOFF 4
648#endif
649#ifndef IPOPT_COPIED
650# define IPOPT_COPIED(x) ((x)&0x80)

--- 71 unchanged lines hidden (view full) ---

722# define IPOPT_SECUR_SECRET ((u_short)0xd788)
723#endif
724#ifndef IPOPT_SECUR_TOPSECRET
725# define IPOPT_SECUR_TOPSECRET ((u_short)0x6bc5)
726#endif
727#ifndef IPOPT_OLEN
728# define IPOPT_OLEN 1
729#endif
730
731#ifdef linux
732#include <linux/in_systm.h>
733/*
734 * TCP States
735 */
736#define TCPS_CLOSED 0 /* closed */
737#define TCPS_LISTEN 1 /* listening for connection */

--- 299 unchanged lines hidden ---