Deleted Added
full compact
ip_compat.h (72006) ip_compat.h (80482)
1/*
1/*
2 * Copyright (C) 1993-2000 by Darren Reed.
2 * Copyright (C) 1993-2001 by Darren Reed.
3 *
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.
4 * See the IPFILTER.LICENCE file for details on licencing.
7 *
8 * @(#)ip_compat.h 1.8 1/14/96
9 * $Id: ip_compat.h,v 2.26.2.9 2001/01/14 14:58:01 darrenr Exp $
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 $
10 * $FreeBSD: head/sys/contrib/ipfilter/netinet/ip_compat.h 72006 2001-02-04 14:26:56Z darrenr $
8 * $FreeBSD: head/sys/contrib/ipfilter/netinet/ip_compat.h 80482 2001-07-28 11:58:26Z darrenr $
11 */
12
13#ifndef __IP_COMPAT_H__
14#define __IP_COMPAT_H__
15
16#ifndef __P
17# ifdef __STDC__
18# define __P(x) x

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

23#ifndef __STDC__
24# undef const
25# define const
26#endif
27
28#ifndef SOLARIS
29#define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
30#endif
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
31#if SOLARIS2 >= 8
32# ifndef USE_INET6
33# define USE_INET6
34# endif
35#endif
36
37#if defined(_KERNEL) || defined(KERNEL) || defined(__KERNEL__)
38# undef KERNEL

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

115# include <inet/ip_if.h>
116# include <netinet/ip6.h>
117# define ipif_local_addr ipif_lcl_addr
118/* Only defined in private include file */
119# ifndef V4_PART_OF_V6
120# define V4_PART_OF_V6(v6) v6.s6_addr32[3]
121# endif
122# 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
123#else
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 */
124# if !defined(__sgi)
125typedef int minor_t;
149# if !defined(__sgi)
150typedef int minor_t;
126#endif
151# endif
127#endif /* SOLARIS */
128#define IPMINLEN(i, h) ((i)->ip_len >= ((i)->ip_hl * 4 + sizeof(struct h)))
129
130#if defined(__FreeBSD__) && (__FreeBSD__ >= 5) && defined(_KERNEL)
131# include <machine/in_cksum.h>
132#endif
133
134#ifndef IP_OFFMASK

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

260#define IPOPT_VISA 142 /* VISA */
261#define IPOPT_IMITD 144 /* IMITD */
262#define IPOPT_EIP 145 /* EIP */
263#define IPOPT_FINN 205 /* FINN */
264
265
266#if defined(__FreeBSD__) && (defined(KERNEL) || defined(_KERNEL))
267# ifdef IPFILTER_LKM
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
268# include <sys/param.h>
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
269# define ACTUALLY_LKM_NOT_KERNEL
270# else
302# define ACTUALLY_LKM_NOT_KERNEL
303# else
271# include <sys/param.h>
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
272# endif
273# if __FreeBSD__ < 3
274# include <machine/spl.h>
275# else
276# if __FreeBSD__ == 3
277# if defined(IPFILTER_LKM) && !defined(ACTUALLY_LKM_NOT_KERNEL)
278# define ACTUALLY_LKM_NOT_KERNEL
279# endif

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

321# endif
322# define ATOMIC_INC64(x) atomic_add_64((uint64_t*)&(x), 1)
323# define ATOMIC_INC32(x) atomic_add_32((uint32_t*)&(x), 1)
324# define ATOMIC_INC16(x) atomic_add_16((uint16_t*)&(x), 1)
325# define ATOMIC_DEC64(x) atomic_add_64((uint64_t*)&(x), -1)
326# define ATOMIC_DEC32(x) atomic_add_32((uint32_t*)&(x), -1)
327# define ATOMIC_DEC16(x) atomic_add_16((uint16_t*)&(x), -1)
328# else
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
329# define ATOMIC_INC(x) { mutex_enter(&ipf_rw); (x)++; \
330 mutex_exit(&ipf_rw); }
331# define ATOMIC_DEC(x) { mutex_enter(&ipf_rw); (x)--; \
332 mutex_exit(&ipf_rw); }
333# endif
334# define MUTEX_ENTER(x) mutex_enter(x)
335# if 1
336# define KRWLOCK_T krwlock_t

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

370# define ntohs(x) (x)
371# define ntohl(x) (x)
372# define htons(x) (x)
373# define htonl(x) (x)
374# endif /* sparc */
375# define KMALLOC(a,b) (a) = (b)kmem_alloc(sizeof(*(a)), KM_NOSLEEP)
376# define KMALLOCS(a,b,c) (a) = (b)kmem_alloc((c), KM_NOSLEEP)
377# define GET_MINOR(x) getminor(x)
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)
378typedef struct qif {
379 struct qif *qf_next;
380 ill_t *qf_ill;
381 kmutex_t qf_lock;
382 void *qf_iptr;
383 void *qf_optr;
384 queue_t *qf_in;
385 queue_t *qf_out;
386 struct qinit *qf_wqinfo;
387 struct qinit *qf_rqinfo;
388 struct qinit qf_wqinit;
389 struct qinit qf_rqinit;
390 mblk_t *qf_m; /* These three fields are for passing data up from */
391 queue_t *qf_q; /* fr_qin and fr_qout to the packet processing. */
392 size_t qf_off;
393 size_t qf_len; /* this field is used for in ipfr_fastroute */
394 char qf_name[8];
395 /*
396 * in case the ILL has disappeared...
397 */
398 size_t qf_hl; /* header length */
399 int qf_sap;
400} qif_t;
401extern ill_t *get_unit __P((char *, int));
402# define GETUNIT(n, v) get_unit(n, v)
403# define IFNAME(x) ((ill_t *)x)->ill_name
404# else /* SOLARIS */
405# if defined(__sgi)
406# define ATOMIC_INC(x) { MUTEX_ENTER(&ipf_rw); \
407 (x)++; MUTEX_EXIT(&ipf_rw); }
408# define ATOMIC_DEC(x) { MUTEX_ENTER(&ipf_rw); \

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

448# endif
449# else
450# ifndef linux
451# define GETUNIT(n, v) ifunit(n)
452# if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199606)) || \
453 (defined(OpenBSD) && (OpenBSD >= 199603))
454# define IFNAME(x) ((struct ifnet *)x)->if_xname
455# else
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
456# define IFNAME(x) ((struct ifnet *)x)->if_name
475# define USE_GETIFNAME 1
476# define IFNAME(x) get_ifname((struct ifnet *)x)
477extern char *get_ifname __P((struct ifnet *));
457# endif
458# endif
459# endif /* sun */
460
461# if defined(sun) && !defined(linux) || defined(__sgi)
462# define UIOMOVE(a,b,c,d) uiomove((caddr_t)a,b,c,d)
463# define SLEEP(id, n) sleep((id), PZERO+1)
464# define WAKEUP(id) wakeup(id)

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

504# define KMALLOCS(a, b, c) MALLOC((a), b, (c), M_TEMP, M_NOWAIT)
505# define KFREE(x) FREE((x), M_TEMP)
506# define KFREES(x,s) FREE((x), M_TEMP)
507# endif /* M_PFIL */
508# define UIOMOVE(a,b,c,d) uiomove(a,b,d)
509# define SLEEP(id, n) tsleep((id), PPAUSE|PCATCH, n, 0)
510# define WAKEUP(id) wakeup(id)
511# endif /* BSD */
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 */
512# if defined(NetBSD) && NetBSD <= 1991011 && NetBSD >= 199407
533# if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199407)) || \
534 (defined(OpenBSD) && (OpenBSD >= 200006))
513# define SPL_NET(x) x = splsoftnet()
514# define SPL_X(x) (void) splx(x)
515# else
516# if !SOLARIS && !defined(linux)
517# define SPL_IMP(x) x = splimp()
518# define SPL_NET(x) x = splnet()
519# define SPL_X(x) (void) splx(x)
520# endif
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
521# endif /* NetBSD && NetBSD <= 1991011 && NetBSD >= 199407 */
543# endif /* NetBSD && (NetBSD <= 1991011) && (NetBSD >= 199407) */
522# define PANIC(x,y) if (x) panic y
523#else /* KERNEL */
524# define SLEEP(x,y) ;
525# define WAKEUP(x) ;
526# define PANIC(x,y) ;
527# define ATOMIC_INC(x) (x)++
528# define ATOMIC_DEC(x) (x)--
529# define MUTEX_ENTER(x) ;

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

572# else
573typedef struct sk_buff mb_t;
574# endif
575# else
576typedef struct mbuf mb_t;
577# endif
578#endif /* SOLARIS */
579
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
580#if defined(linux) || defined(__sgi)
581/*
582 * These #ifdef's are here mainly for linux, but who knows, they may
583 * not be in other places or maybe one day linux will grow up and some
584 * of these will turn up there too.
585 */
586#ifndef ICMP_MINLEN
587# define ICMP_MINLEN 8
588#endif

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

611# define ICMP_IREQREPLY ICMP_INFO_REPLY
612#endif
613#ifndef ICMP_MASKREQ
614# define ICMP_MASKREQ ICMP_ADDRESS
615#endif
616#ifndef ICMP_MASKREPLY
617# define ICMP_MASKREPLY ICMP_ADDRESSREPLY
618#endif
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
619#ifndef IPVERSION
620# define IPVERSION 4
621#endif
622#ifndef IPOPT_MINOFF
623# define IPOPT_MINOFF 4
624#endif
625#ifndef IPOPT_COPIED
626# define IPOPT_COPIED(x) ((x)&0x80)

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

698# define IPOPT_SECUR_SECRET ((u_short)0xd788)
699#endif
700#ifndef IPOPT_SECUR_TOPSECRET
701# define IPOPT_SECUR_TOPSECRET ((u_short)0x6bc5)
702#endif
703#ifndef IPOPT_OLEN
704# define IPOPT_OLEN 1
705#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
706#endif /* linux || __sgi */
707
708#ifdef linux
709#include <linux/in_systm.h>
710/*
711 * TCP States
712 */
713#define TCPS_CLOSED 0 /* closed */
714#define TCPS_LISTEN 1 /* listening for connection */

--- 299 unchanged lines hidden ---
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 ---