Module Name: src
Committed By: christos
Date: Fri Aug 5 09:05:02 UTC 2016
Modified Files:
src/sys/external/bsd/ipf/netinet: ip_compat.h
Log Message:
unifdef
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/ipf/netinet/ip_compat.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/external/bsd/ipf/netinet/ip_compat.h
diff -u src/sys/external/bsd/ipf/netinet/ip_compat.h:1.10 src/sys/external/bsd/ipf/netinet/ip_compat.h:1.11
--- src/sys/external/bsd/ipf/netinet/ip_compat.h:1.10 Fri Jun 10 09:31:44 2016
+++ src/sys/external/bsd/ipf/netinet/ip_compat.h Fri Aug 5 05:05:02 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_compat.h,v 1.10 2016/06/10 13:31:44 ozaki-r Exp $ */
+/* $NetBSD: ip_compat.h,v 1.11 2016/08/05 09:05:02 christos Exp $ */
/*
* Copyright (C) 2012 by Darren Reed.
@@ -26,13 +26,11 @@
# define __KERNEL__
#endif
-#ifndef SOLARIS
# if (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
# define SOLARIS 1
# else
# define SOLARIS 0
# endif
-#endif
#if (defined(SOLARIS2) && (SOLARIS2 >= 8))
# ifndef USE_INET6
# define USE_INET6
@@ -132,701 +130,26 @@ struct file;
# endif
#endif
-#if defined(__NetBSD_Version__)
# define NETBSD_GE_REV(x) (__NetBSD_Version__ >= (x))
# define NETBSD_GT_REV(x) (__NetBSD_Version__ > (x))
# define NETBSD_LT_REV(x) (__NetBSD_Version__ < (x))
-#else
-# define NETBSD_GE_REV(x) 0
-# define NETBSD_GT_REV(x) 0
-# define NETBSD_LT_REV(x) 0
-#endif
-#if defined(__FreeBSD_version)
-# define FREEBSD_GE_REV(x) (__FreeBSD_version >= (x))
-# define FREEBSD_GT_REV(x) (__FreeBSD_version > (x))
-# define FREEBSD_LT_REV(x) (__FreeBSD_version < (x))
-#else
# define FREEBSD_GE_REV(x) 0
# define FREEBSD_GT_REV(x) 0
# define FREEBSD_LT_REV(x) 0
-#endif
-#if defined(_BSDI_VERSION)
-# define BSDOS_GE_REV(x) (_BSDI_VERSION >= (x))
-# define BSDOS_GT_REV(x) (_BSDI_VERSION > (x))
-# define BSDOS_LT_REV(x) (_BSDI_VERSION < (x))
-#else
# define BSDOS_GE_REV(x) 0
# define BSDOS_GT_REV(x) 0
# define BSDOS_LT_REV(x) 0
-#endif
-#if defined(OpenBSD)
-# define OPENBSD_GE_REV(x) (OpenBSD >= (x))
-# define OPENBSD_GT_REV(x) (OpenBSD > (x))
-# define OPENBSD_LT_REV(x) (OpenBSD < (x))
-#else
# define OPENBSD_GE_REV(x) 0
# define OPENBSD_GT_REV(x) 0
# define OPENBSD_LT_REV(x) 0
-#endif
-#if defined(BSD)
# define BSD_GE_YEAR(x) (BSD >= (x))
# define BSD_GT_YEAR(x) (BSD > (x))
# define BSD_LT_YEAR(x) (BSD < (x))
-#else
-# define BSD_GE_YEAR(x) 0
-# define BSD_GT_YEAR(x) 0
-# define BSD_LT_YEAR(x) 0
-#endif
-
-
-/* ----------------------------------------------------------------------- */
-/* S O L A R I S */
-/* ----------------------------------------------------------------------- */
-#if SOLARIS
-# define MENTAT 1
-# include <sys/cmn_err.h>
-# include <sys/isa_defs.h>
-# include <sys/stream.h>
-# include <sys/ioccom.h>
-# include <sys/sysmacros.h>
-# include <sys/kmem.h>
-# if SOLARIS2 >= 10
-# include <sys/procset.h>
-# include <sys/proc.h>
-# include <sys/devops.h>
-# include <sys/ddi_impldefs.h>
-# include <sys/sdt.h>
-# endif
-/*
- * because Solaris 2 defines these in two places :-/
- */
-# ifndef _KERNEL
-# define ADD_KERNEL
-# define _KERNEL
-# undef RES_INIT
-# endif /* _KERNEL */
-
-# if SOLARIS2 >= 8
-# include <netinet/ip6.h>
-# include <netinet/icmp6.h>
-# endif
-
-# include <inet/common.h>
-/* These 5 are defined in <inet/ip.h> and <netinet/ip.h> */
-# undef IPOPT_EOL
-# undef IPOPT_NOP
-# undef IPOPT_LSRR
-# undef IPOPT_RR
-# undef IPOPT_SSRR
-# ifdef i386
-# define _SYS_PROMIF_H
-# endif
-# ifdef ADD_KERNEL
-# undef _KERNEL
-# endif
-# include <inet/mib2.h>
-# include <inet/ip.h>
-# undef COPYOUT
-# if !defined(_SYS_NETI_H)
-# include <inet/ip_ire.h>
-# endif
-# if SOLARIS2 >= 8
-
-# include <inet/ip_if.h>
-# define ipif_local_addr ipif_lcl_addr
-/* Only defined in private include file */
-# ifndef V4_PART_OF_V6
-# define V4_PART_OF_V6(v6) v6.s6_addr32[3]
-# endif
-struct ip6_ext {
- u_char ip6e_nxt;
- u_char ip6e_len;
-};
-# endif /* SOLARIS2 >= 8 */
-
-# if SOLARIS2 >= 6
-# include <sys/atomic.h>
-typedef uint8_t u_int8_t;
-typedef uint32_t u_32_t;
-# else
-typedef unsigned char u_int8_t;
-typedef unsigned int u_32_t;
-# endif
-# define U_32_T 1
-# if SOLARIS2 >= 7
-# define USE_QUAD_T 1
-# define U_QUAD_T uint64_t
-# define QUAD_T int64_t
-# endif
-
-# ifdef _KERNEL
-# define NEED_LOCAL_RAND 1
-# define KRWLOCK_T krwlock_t
-# define KMUTEX_T kmutex_t
-# if !defined(FW_HOOKS)
-# include "qif.h"
-# include "pfil.h"
-# endif
-# if SOLARIS2 >= 6
-# if SOLARIS2 == 6
-# define ATOMIC_INCL(x) atomic_add_long((uint32_t*)&(x), 1)
-# define ATOMIC_DECL(x) atomic_add_long((uint32_t*)&(x), -1)
-# else
-# define ATOMIC_INCL(x) atomic_add_long(&(x), 1)
-# define ATOMIC_DECL(x) atomic_add_long(&(x), -1)
-# endif /* SOLARIS2 == 6 */
-# define ATOMIC_INC64(x) atomic_add_64((uint64_t*)&(x), 1)
-# define ATOMIC_INC32(x) atomic_add_32((uint32_t*)&(x), 1)
-# define ATOMIC_DEC64(x) atomic_add_64((uint64_t*)&(x), -1)
-# define ATOMIC_DEC32(x) atomic_add_32((uint32_t*)&(x), -1)
-# else
-# define ATOMIC_INC(x) { mutex_enter(&softc->ipf_rw); (x)++; \
- mutex_exit(&softc->ipf_rw); }
-# define ATOMIC_DEC(x) { mutex_enter(&softc->ipf_rw); (x)--; \
- mutex_exit(&softc->ipf_rw); }
-# endif /* SOLARIS2 >= 6 */
-# define USE_MUTEXES
-# define MUTEX_ENTER(x) mutex_enter(&(x)->ipf_lk)
-# define READ_ENTER(x) rw_enter(&(x)->ipf_lk, RW_READER)
-# define WRITE_ENTER(x) rw_enter(&(x)->ipf_lk, RW_WRITER)
-# define MUTEX_DOWNGRADE(x) rw_downgrade(&(x)->ipf_lk)
-# define RWLOCK_INIT(x, y) rw_init(&(x)->ipf_lk, (y), \
- RW_DRIVER, NULL)
-# define RWLOCK_EXIT(x) rw_exit(&(x)->ipf_lk)
-# define RW_DESTROY(x) rw_destroy(&(x)->ipf_lk)
-# define MUTEX_INIT(x, y) mutex_init(&(x)->ipf_lk, (y), \
- MUTEX_DRIVER, NULL)
-# define MUTEX_DESTROY(x) mutex_destroy(&(x)->ipf_lk)
-# define MUTEX_NUKE(x) bzero((x), sizeof(*(x)))
-# define MUTEX_EXIT(x) mutex_exit(&(x)->ipf_lk)
-# define COPYIN(a,b,c) copyin((caddr_t)(a), (caddr_t)(b), (c))
-# define COPYOUT(a,b,c) copyout((caddr_t)(a), (caddr_t)(b), (c))
-# define BCOPYIN(a,b,c) copyin((caddr_t)(a), (caddr_t)(b), (c))
-# define BCOPYOUT(a,b,c) copyout((caddr_t)(a), (caddr_t)(b), (c))
-# define UIOMOVE(a,b,c,d) uiomove((caddr_t)a,b,c,d)
-# define KFREE(x) kmem_free((char *)(x), sizeof(*(x)))
-# define KFREES(x,s) kmem_free((char *)(x), (s))
-# define SPL_SCHED(x) ;
-# define SPL_NET(x) ;
-# define SPL_IMP(x) ;
-# undef SPL_X
-# define SPL_X(x) ;
-# ifdef sparc
-# define ntohs(x) (x)
-# define ntohl(x) (x)
-# define htons(x) (x)
-# define htonl(x) (x)
-# endif /* sparc */
-# define KMALLOC(a,b) (a) = (b)kmem_alloc(sizeof(*(a)), KM_NOSLEEP)
-# define KMALLOCS(a,b,c) (a) = (b)kmem_alloc((c), KM_NOSLEEP)
-# define GET_MINOR(x) getminor(x)
-extern void *get_unit(void *, char *, int);
-# define GETIFP(n, v) get_unit(softc, n, v)
-# if defined(INSTANCES)
-# include <sys/hook.h>
-# include <sys/neti.h>
-typedef struct qpktinfo {
- void *qpi_real; /* the real one on the STREAM */
- void *qpi_ill; /* COPIED */
- mblk_t *qpi_m;
- queue_t *qpi_q;
- void *qpi_data; /* where layer 3 header starts */
- size_t qpi_off;
- int qpi_flags; /* COPIED */
-} qpktinfo_t;
-
-#define QF_MULTICAST 0x0001
-#define QF_BROADCAST 0x0002
-
-typedef struct qifpkt {
- struct qifpkt *qp_next;
- char qp_ifname[LIFNAMSIZ];
- int qp_sap;
- mblk_t *qp_mb;
- int qp_inout;
-} qifpkt_t;
-
-# define COPYIFNAME(v, x,b) \
- do { \
- if ((v) == 4) { \
- net_getifname(softc->ipf_nd_v4, \
- (phy_if_t)x, b, \
- sizeof(b)); \
- } else { \
- net_getifname(softc->ipf_nd_v6, \
- (phy_if_t)x, b, \
- sizeof(b)); \
- } \
- } while (0)
-# define GETIFMTU_4(x) net_getmtu(softc->ipf_nd_v4, (phy_if_t)x, 0)
-# define GETIFMTU_6(x) net_getmtu(softc->ipf_nd_v6, (phy_if_t)x, 0)
-# define GET_SOFTC(x) ipf_find_softc(x)
-# else
-# define FASTROUTE_RECURSION 1
-# define GET_SOFTC(x) &ipfmain
-# define GETIFMTU_4(x) ((qif_t *)x)->qf_max_frag
-# define GETIFMTU_6(x) ((qif_t *)x)->qf_max_frag
-# define IFNAME(x) ((qif_t *)x)->qf_name
-# define COPYIFNAME(v, x, b) \
- (void) strncpy(b, ((qif_t *)x)->qf_name, \
- LIFNAMSIZ)
-# endif
-# define GETKTIME(x) uniqtime((struct timeval *)x)
-# define MSGDSIZE(m) msgdsize(m)
-# define M_LEN(m) ((m)->b_wptr - (m)->b_rptr)
-# define M_ADJ(m,x) adjmsg(m, x)
-# define M_COPY(x) dupmsg((x))
-# define MTOD(m,t) ((t)((m)->b_rptr))
-# define MTYPE(m) ((m)->b_datap->db_type)
-# define FREE_MB_T(m) freemsg(m)
-# define ALLOC_MB_T(m,l) (m) = allocmbt(l)
-# define PREP_MB_T(f,m) ipf_prependmbt(f, m)
-# define M_DUP(m) copymsg(m)
-# define m_next b_cont
-# define IPF_PANIC(x,y) if (x) { printf y; cmn_err(CE_PANIC, "ipf_panic"); }
-typedef mblk_t mb_t;
-extern void mb_copydata __P((mblk_t *, size_t, size_t, char *));
-extern void mb_copyback __P((mblk_t *, size_t, size_t, char *));
-# endif /* _KERNEL */
-
-# if (SOLARIS2 >= 7)
-# ifdef lint
-# define ALIGN32(ptr) (ptr ? 0L : 0L)
-# define ALIGN16(ptr) (ptr ? 0L : 0L)
-# else
-# define ALIGN32(ptr) (ptr)
-# define ALIGN16(ptr) (ptr)
-# endif
-# endif
-
-# if SOLARIS2 < 6
-typedef struct uio uio_t;
-# endif
-typedef int ioctlcmd_t;
-
-# define OS_RECOGNISED 1
-
-#endif /* SOLARIS */
-/* ----------------------------------------------------------------------- */
-/* H P U X */
-/* ----------------------------------------------------------------------- */
-#ifdef __hpux
-# define MENTAT 1
-# include <sys/sysmacros.h>
-# include <sys/spinlock.h>
-# include <sys/lock.h>
-# include <sys/stream.h>
-# ifdef USE_INET6
-# include <netinet/if_ether.h>
-# include <netinet/ip6.h>
-# include <netinet/icmp6.h>
-typedef struct ip6_hdr ip6_t;
-# endif
-
-# ifdef _KERNEL
-# define FASTROUTE_RECURSION 1
-# if (HPUXREV >= 1111)
-# define IPL_SELECT
-# ifdef IPL_SELECT
-# include <machine/sys/user.h>
-# include <sys/kthread_iface.h>
-# define READ_COLLISION 0x01
-
-typedef struct iplog_select_s {
- kthread_t *read_waiter;
- int state;
-} iplog_select_t;
-# endif
-# endif
-
-# define GETKTIME(x) uniqtime((struct timeval *)x)
-
-# if HPUXREV == 1111
-# include "kern_svcs.h"
-# else
-# include <sys/kern_svcs.h>
-# endif
-# undef ti_flags
-# undef TCP_NODELAY
-# undef TCP_MAXSEG
-# include <sys/reg.h>
-# include "../netinet/ip_info.h"
-/*
- * According to /usr/include/sys/spinlock.h on HP-UX 11.00, these functions
- * are available. Attempting to use them actually results in unresolved
- * symbols when it comes time to load the module.
- * This has been fixed! Yipee!
- */
-# if 1
-# ifdef __LP64__
-# define ATOMIC_INCL(x) lock_and_incr_int64(&softc->ipf_rw.ipf_lk, &(x), 1)
-# define ATOMIC_DECL(x) lock_and_incr_int64(&softc->ipf_rw.ipf_lk, &(x), -1)
-# else
-# define ATOMIC_INCL(x) lock_and_incr_int32(&softc->ipf_rw.ipf_lk, &(x), 1)
-# define ATOMIC_DECL(x) lock_and_incr_int32(&softc->ipf_rw.ipf_lk, &(x), -1)
-# endif
-# define ATOMIC_INC64(x) lock_and_incr_int64(&softc->ipf_rw.ipf_lk, &(x), 1)
-# define ATOMIC_INC32(x) lock_and_incr_int32(&softc->ipf_rw.ipf_lk, &(x), 1)
-# define ATOMIC_DEC64(x) lock_and_incr_int64(&softc->ipf_rw.ipf_lk, &(x), -1)
-# define ATOMIC_DEC32(x) lock_and_incr_int32(&softc->ipf_rw.ipf_lk, &(x), -1)
-# else /* 0 */
-# define ATOMIC_INC64(x) { MUTEX_ENTER(&softc->ipf_rw); (x)++; \
- MUTEX_EXIT(&softc->ipf_rw); }
-# define ATOMIC_DEC64(x) { MUTEX_ENTER(&softc->ipf_rw); (x)--; \
- MUTEX_EXIT(&softc->ipf_rw); }
-# define ATOMIC_INC32(x) { MUTEX_ENTER(&softc->ipf_rw); (x)++; \
- MUTEX_EXIT(&softc->ipf_rw); }
-# define ATOMIC_DEC32(x) { MUTEX_ENTER(&softc->ipf_rw); (x)--; \
- MUTEX_EXIT(&softc->ipf_rw); }
-# define ATOMIC_INCL(x) { MUTEX_ENTER(&softc->ipf_rw); (x)++; \
- MUTEX_EXIT(&softc->ipf_rw); }
-# define ATOMIC_DECL(x) { MUTEX_ENTER(&softc->ipf_rw); (x)--; \
- MUTEX_EXIT(&softc->ipf_rw); }
-# define ATOMIC_INC(x) { MUTEX_ENTER(&softc->ipf_rw); (x)++; \
- MUTEX_EXIT(&softc->ipf_rw); }
-# define ATOMIC_DEC(x) { MUTEX_ENTER(&softc->ipf_rw); (x)--; \
- MUTEX_EXIT(&softc->ipf_rw); }
-# endif
-# define ip_cksum ip_csuma
-# define memcpy(a,b,c) bcopy((void *)b, (void *)a, c)
-# define USE_MUTEXES
-# define MUTEX_INIT(x, y) initlock(&(x)->ipf_lk, 0, 0, (y))
-# define MUTEX_ENTER(x) spinlock(&(x)->ipf_lk)
-# define MUTEX_EXIT(x) spinunlock(&(x)->ipf_lk);
-# define MUTEX_DESTROY(x)
-# define MUTEX_NUKE(x) bzero((char *)(x), sizeof(*(x)))
-# define KMUTEX_T lock_t
-# define kmutex_t lock_t /* for pfil.h */
-# define krwlock_t lock_t /* for pfil.h */
-/*
- * The read-write lock implementation in HP-UX 11.0 is crippled - it can
- * only be used by threads working in a user context!
- * This has been fixed! Yipee! (Or at least it does in 11.00, not 11.11..)
- */
-# if HPUXREV < 1111
-# define MUTEX_DOWNGRADE(x) lock_write_to_read(x)
-# define KRWLOCK_T struct rw_lock
-# define READ_ENTER(x) lock_read(&(x)->ipf_lk)
-# define WRITE_ENTER(x) lock_write(&(x)->ipf_lk)
-# if HPUXREV >= 1111
-# define RWLOCK_INIT(x, y) rwlock_init4(&(x)->ipf_lk, 0, RWLCK_CANSLEEP, 0, y)
-# else
-# define RWLOCK_INIT(x, y) lock_init3(&(x)->ipf_lk, 0, 1, 0, 0, y)
-# endif
-# define RWLOCK_EXIT(x) lock_done(&(x)->ipf_lk)
-# else
-# define KRWLOCK_T lock_t
-# define KMUTEX_T lock_t
-# define READ_ENTER(x) MUTEX_ENTER(x)
-# define WRITE_ENTER(x) MUTEX_ENTER(x)
-# define MUTEX_DOWNGRADE(x)
-# define RWLOCK_INIT(x, y) initlock(&(x)->ipf_lk, 0, 0, y)
-# define RWLOCK_EXIT(x) MUTEX_EXIT(x)
-# endif
-# define RW_DESTROY(x)
-# define COPYIN(a,b,c) copyin((caddr_t)(a), (caddr_t)(b), (c))
-# define COPYOUT(a,b,c) copyout((caddr_t)(a), (caddr_t)(b), (c))
-# define SPL_SCHED(x) ;
-# define SPL_NET(x) ;
-# define SPL_IMP(x) ;
-# undef SPL_X
-# define SPL_X(x) ;
-extern void *get_unit(char *, int);
-# define GETIFP(n, v) get_unit(n, v)
-# define GETIFMTU_4(x) ((ill_t *)x)->ill_mtu
-# define GETIFMTU_6(x) ((ill_t *)x)->ill_mtu
-# define IFNAME(x, b) ((ill_t *)x)->ill_name
-# define COPYIFNAME(v, x, b) \
- (void) strncpy(b, ((qif_t *)x)->qf_name, \
- LIFNAMSIZ)
-# define UIOMOVE(a,b,c,d) uiomove((void *)a,b,c,d)
-# define SLEEP(id, n) { lock_t *_l = get_sleep_lock((void *)id); \
- sleep(id, PZERO+1); \
- spinunlock(_l); \
- }
-# define WAKEUP(id,x) { lock_t *_l = get_sleep_lock((void *)id); \
- wakeup(id + x); \
- spinunlock(_l); \
- }
-# define POLLWAKEUP(x) ;
-# define KMALLOC(a, b) MALLOC((a), b, sizeof(*(a)), M_IOSYS, M_NOWAIT)
-# define KMALLOCS(a, b, c) (a) = (b)malloc((c), M_IOSYS, M_NOWAIT)
-# define KFREE(x) kmem_free((char *)(x), sizeof(*(x)))
-# define KFREES(x,s) kmem_free((char *)(x), (s))
-# define MSGDSIZE(m) msgdsize(m)
-# define M_ADJ(m,x) adjmsg(m, x)
-# define M_LEN(m) ((m)->b_wptr - (m)->b_rptr)
-# define M_COPY(m) copymsg((m))
-# define M_DUP(m) dupmsg(m)
-# define MTOD(m,t) ((t)((m)->b_rptr))
-# define MTYPE(m) ((m)->b_datap->db_type)
-# define FREE_MB_T(m) freemsg(m)
-# define m_next b_cont
-# define IPF_PANIC(x,y) if (x) { printf y; panic("ipf_panic"); }
-typedef mblk_t mb_t;
-
-# include "qif.h"
-# include "pfil.h"
-
-# else /* _KERNEL */
-
-typedef unsigned char uchar_t;
-
-# ifndef _SYS_STREAM_INCLUDED
-typedef char * mblk_t;
-typedef void *queue_t;
-typedef u_long ulong;
-# endif
-# include <netinet/ip_info.h>
-
-# endif /* _KERNEL */
-
-# ifdef lint
-# define ALIGN32(ptr) (ptr ? 0L : 0L)
-# define ALIGN16(ptr) (ptr ? 0L : 0L)
-# else
-# define ALIGN32(ptr) (ptr)
-# define ALIGN16(ptr) (ptr)
-# endif
-
-typedef struct uio uio_t;
-typedef int ioctlcmd_t;
-typedef int minor_t;
-typedef unsigned int u_32_t;
-# define U_32_T 1
-
-# define OS_RECOGNISED 1
-
-#endif /* __hpux */
-
-/* ----------------------------------------------------------------------- */
-/* I R I X */
-/* ----------------------------------------------------------------------- */
-#ifdef __sgi
-# undef MENTAT
-# if IRIX < 60500
-typedef struct uio uio_t;
-# endif
-typedef int ioctlcmd_t;
-typedef u_int32_t u_32_t;
-# define U_32_T 1
-
-# ifdef INET6
-# define USE_INET6
-# endif
-
-# define hz HZ
-# include <sys/ksynch.h>
-# define IPF_LOCK_PL plhi
-# include <sys/sema.h>
-# undef kmutex_t
-typedef struct {
- lock_t *l;
- int pl;
-} kmutex_t;
-
-# ifdef MUTEX_INIT
-# define KMUTEX_T mutex_t
-# else
-# define KMUTEX_T kmutex_t
-# define KRWLOCK_T kmutex_t
-# endif
-
-# ifdef _KERNEL
-# define NEED_LOCAL_RAND 1
-# define ATOMIC_INC(x) { MUTEX_ENTER(&softc->ipf_rw); \
- (x)++; MUTEX_EXIT(&softc->ipf_rw); }
-# define ATOMIC_DEC(x) { MUTEX_ENTER(&softc->ipf_rw); \
- (x)--; MUTEX_EXIT(&softc->ipf_rw); }
-# define USE_MUTEXES
-# ifdef MUTEX_INIT
-# include <sys/atomic_ops.h>
-# define ATOMIC_INCL(x) atomicAddUlong(&(x), 1)
-# define ATOMIC_INC64(x) atomicAddUint64(&(x), 1)
-# define ATOMIC_INC32(x) atomicAddUint(&(x), 1)
-# define ATOMIC_DECL(x) atomicAddUlong(&(x), -1)
-# define ATOMIC_DEC64(x) atomicAddUint64(&(x), -1)
-# define ATOMIC_DEC32(x) atomicAddUint(&(x), -1)
-# undef MUTEX_INIT
-# define MUTEX_INIT(x, y) mutex_init(&(x)->ipf_lk, \
- MUTEX_DEFAULT, y)
-# undef MUTEX_ENTER
-# define MUTEX_ENTER(x) mutex_lock(&(x)->ipf_lk, 0)
-# undef MUTEX_EXIT
-# define MUTEX_EXIT(x) mutex_unlock(&(x)->ipf_lk)
-# undef MUTEX_DESTROY
-# define MUTEX_DESTROY(x) mutex_destroy(&(x)->ipf_lk)
-# define MUTEX_DOWNGRADE(x) mrdemote(&(x)->ipf_lk)
-# define KRWLOCK_T mrlock_t
-# define RWLOCK_INIT(x, y) mrinit(&(x)->ipf_lk, y)
-# undef RW_DESTROY
-# define RW_DESTROY(x) mrfree(&(x)->ipf_lk)
-# define READ_ENTER(x) RW_RDLOCK(&(x)->ipf_lk)
-# define WRITE_ENTER(x) RW_WRLOCK(&(x)->ipf_lk)
-# define RWLOCK_EXIT(x) RW_UNLOCK(&(x)->ipf_lk)
-# else
-# define READ_ENTER(x) MUTEX_ENTER(&(x)->ipf_lk)
-# define WRITE_ENTER(x) MUTEX_ENTER(&(x)->ipf_lk)
-# define MUTEX_DOWNGRADE(x) ;
-# define RWLOCK_EXIT(x) MUTEX_EXIT(&(x)->ipf_lk)
-# define MUTEX_EXIT(x) UNLOCK((x)->ipf_lk.l, (x)->ipf_lk.pl);
-# define MUTEX_INIT(x,y) (x)->ipf_lk.l = LOCK_ALLOC((uchar_t)-1, IPF_LOCK_PL, (lkinfo_t *)-1, KM_NOSLEEP)
-# define MUTEX_DESTROY(x) LOCK_DEALLOC((x)->ipf_lk.l)
-# define MUTEX_ENTER(x) (x)->ipf_lk.pl = LOCK((x)->ipf_lk.l, \
- IPF_LOCK_PL);
-# endif
-# define MUTEX_NUKE(x) bzero((x), sizeof(*(x)))
-# define FREE_MB_T(m) m_freem(m)
-# define MTOD(m,t) mtod(m,t)
-# define COPYIN(a,b,c) (bcopy((caddr_t)(a), (caddr_t)(b), (c)), 0)
-# define COPYOUT(a,b,c) (bcopy((caddr_t)(a), (caddr_t)(b), (c)), 0)
-# define UIOMOVE(a,b,c,d) uiomove((caddr_t)a,b,c,d)
-# define SLEEP(id, n) sleep((id), PZERO+1)
-# define WAKEUP(id,x) wakeup(id+x)
-# define POLLWAKEUP(x) ;
-# define KFREE(x) kmem_free((char *)(x), sizeof(*(x)))
-# define KFREES(x,s) kmem_free((char *)(x), (s))
-# define GETIFP(n,v) ifunit(n)
-# define GETIFMTU_4(x) ((struct ifnet *)x)->if_mtu
-# define GETIFMTU_6(x) ((struct ifnet *)x)->if_mtu
-# include <sys/kmem.h>
-# include <sys/ddi.h>
-# define KMALLOC(a,b) (a) = (b)kmem_alloc(sizeof(*(a)), KM_NOSLEEP)
-# define KMALLOCS(a,b,c) (a) = (b)kmem_alloc((c), KM_NOSLEEP)
-# define GET_MINOR(x) getminor(x)
-# define USE_SPL 1
-# define SPL_IMP(x) (x) = splimp()
-# define SPL_NET(x) (x) = splnet()
-# define SPL_SCHED(x) (x) = splsched()
-# define SPL_X(x) (void) splx(x)
-extern void m_copydata(struct mbuf *, int, int, void *);
-extern void m_copyback(struct mbuf *, int, int, void *);
-# define M_ADJ(m,x) m_adj(m, x)
-# define M_LEN(x) (x)->m_len
-# define M_COPY(m) m_copy((m), 0, M_COPYALL)
-# define GETKTIME(x) microtime((struct timeval *)x)
-# define IFNAME(x) ((struct ifnet *)x)->if_name
-# define IPF_PANIC(x,y) if (x) { printf y; panic("ipf_panic"); }
-typedef struct mbuf mb_t;
-# else
-# undef RW_DESTROY
-# undef MUTEX_INIT
-# undef MUTEX_DESTROY
-# endif /* _KERNEL */
-
-# define OS_RECOGNISED 1
-
-#endif /* __sgi */
-
-/* ----------------------------------------------------------------------- */
-/* T R U 6 4 */
-/* ----------------------------------------------------------------------- */
-#ifdef __osf__
-# undef MENTAT
-
-# include <kern/lock.h>
-# include <sys/sysmacros.h>
-
-# ifdef _KERNEL
-# define NEED_LOCAL_RAND 1
-# define KMUTEX_T simple_lock_data_t
-# define KRWLOCK_T lock_data_t
-# include <net/net_globals.h>
-# define USE_MUTEXES
-# define READ_ENTER(x) lock_read(&(x)->ipf_lk)
-# define WRITE_ENTER(x) lock_write(&(x)->ipf_lk)
-# define MUTEX_DOWNGRADE(x) lock_write_to_read(&(x)->ipf_lk)
-# define RWLOCK_INIT(x, y) lock_init(&(x)->ipf_lk, TRUE)
-# define RWLOCK_EXIT(x) lock_done(&(x)->ipf_lk)
-# define RW_DESTROY(x) lock_terminate(&(x)->ipf_lk)
-# define MUTEX_ENTER(x) simple_lock(&(x)->ipf_lk)
-# define MUTEX_INIT(x, y) simple_lock_init(&(x)->ipf_lk)
-# define MUTEX_DESTROY(x) simple_lock_terminate(&(x)->ipf_lk)
-# define MUTEX_EXIT(x) simple_unlock(&(x)->ipf_lk)
-# define MUTEX_NUKE(x) bzero(x, sizeof(*(x)))
-# define ATOMIC_INC64(x) atomic_incq((uint64_t*)&(x))
-# define ATOMIC_DEC64(x) atomic_decq((uint64_t*)&(x))
-# define ATOMIC_INC32(x) atomic_incl((uint32_t*)&(x))
-# define ATOMIC_DEC32(x) atomic_decl((uint32_t*)&(x))
-# define ATOMIC_INCL(x) atomic_incl((uint32_t*)&(x))
-# define ATOMIC_DECL(x) atomic_decl((uint32_t*)&(x))
-# define ATOMIC_INC(x) { simple_lock(&softc->ipf_rw); (x)++; \
- simple_unlock(&softc->ipf_rw); }
-# define ATOMIC_DEC(x) { simple_lock(&softc->ipf_rw); (x)--; \
- simple_unlock(&softc->ipf_rw); }
-# define SPL_SCHED(x) ;
-# define SPL_NET(x) ;
-# define SPL_IMP(x) ;
-# undef SPL_X
-# define SPL_X(x) ;
-# define UIOMOVE(a,b,c,d) uiomove((void *)a, b, d)
-# define FREE_MB_T(m) m_freem(m)
-# define MTOD(m,t) mtod(m,t)
-# define GETIFP(n, v) ifunit(n)
-# define GETIFMTU_4(x) ((struct ifnet *)x)->if_mtu
-# define GETIFMTU_6(x) ((struct ifnet *)x)->if_mtu
-# define GET_MINOR getminor
-# define WAKEUP(id,x) wakeup(id + x)
-# define POLLWAKEUP(x) ;
-# define COPYIN(a,b,c) copyin((caddr_t)(a), (caddr_t)(b), (c))
-# define COPYOUT(a,b,c) copyout((caddr_t)(a), (caddr_t)(b), (c))
-# define KMALLOC(a, b) MALLOC((a), b, sizeof(*(a)), M_PFILT, M_NOWAIT)
-# define KMALLOCS(a, b, c) (a) = (b)malloc((c), M_PFILT, \
- ((c) > 4096) ? M_WAITOK : M_NOWAIT)
-# define KFREE(x) FREE((x), M_PFILT)
-# define KFREES(x,s) FREE((x), M_PFILT)
-# define MSGDSIZE(m) mbufchainlen(m)
-# define M_LEN(m) (m)->m_len
-# define M_ADJ(m,x) m_adj(m, x)
-# define M_COPY(m) m_copy((m), 0, M_COPYALL)
-# define M_DUP(m) m_copy((m), 0, M_COPYALL)
-# define GETKTIME(x) microtime((struct timeval *)x)
-# define IFNAME(x) ((struct ifnet *)x)->if_name
-# define IPF_PANIC(x,y) if (x) { printf y; panic("ipf_panic"); }
-# define selinfo sel_queue
-typedef struct mbuf mb_t;
-# endif /* _KERNEL */
-
-# if (defined(_KERNEL) || defined(_NO_BITFIELDS) || (__STDC__ == 1))
-# define IP_V(x) ((x)->ip_vhl >> 4)
-# define IP_HL(x) ((x)->ip_vhl & 0xf)
-# define IP_V_A(x,y) (x)->ip_vhl |= (((y) << 4) & 0xf0)
-# define IP_HL_A(x,y) (x)->ip_vhl |= ((y) & 0xf)
-# define TCP_X2(x) ((x)->th_xoff & 0xf)
-# define TCP_X2_A(x,y) (x)->th_xoff |= ((y) & 0xf)
-# define TCP_OFF(x) ((x)->th_xoff >> 4)
-# define TCP_OFF_A(x,y) (x)->th_xoff |= (((y) << 4) & 0xf0)
-# endif
-# if TRU64 <= 1885
-# define ip6_vfc ip6_vcf
-# endif
-
-/*
- * These are from's Solaris' #defines for little endian.
- */
-#define IP6F_MORE_FRAG 0x0100
-#define IP6F_RESERVED_MASK 0x0600
-#define IP6F_OFF_MASK 0xf8ff
-
-struct ip6_ext {
- u_char ip6e_nxt;
- u_char ip6e_len;
-};
-
-typedef int ioctlcmd_t;
-/*
- * Really, any arch where sizeof(long) != sizeof(int).
- */
-typedef unsigned int u_32_t;
-# define U_32_T 1
-
-# define OS_RECOGNISED 1
-#endif /* __osf__ */
/* ----------------------------------------------------------------------- */
/* N E T B S D */
@@ -959,656 +282,9 @@ typedef u_int32_t u_32_t;
# define OS_RECOGNISED 1
#endif /* __NetBSD__ */
-
-/* ----------------------------------------------------------------------- */
-/* F R E E B S D */
-/* ----------------------------------------------------------------------- */
-#ifdef __FreeBSD__
-# if (__FreeBSD_version < 400000)
-# define NEED_LOCAL_RAND 1
-# endif
-# if defined(_KERNEL)
-# if (__FreeBSD_version >= 500000)
-# include "opt_bpf.h"
-# endif
-# if defined(__FreeBSD_version) && (__FreeBSD_version >= 500000)
-# include "opt_inet6.h"
-# endif
-# if defined(INET6) && !defined(USE_INET6)
-# define USE_INET6
-# endif
-# endif
-
-# if defined(_KERNEL)
-# include <netinet/ip_var.h>
-# if (__FreeBSD_version >= 500024)
-# if (__FreeBSD_version >= 500043)
-# define p_cred td_ucred
-# define p_uid td_ucred->cr_ruid
-# else
-# define p_cred t_proc->p_cred
-# define p_uid t_proc->p_cred->p_ruid
-# endif
-# else
-# define p_uid p_cred->p_ruid
-# endif /* __FreeBSD_version >= 500024 */
-
-# if (__FreeBSD_version >= 400000)
-/*
- * When #define'd, the 5.2.1 kernel panics when used with the ftp proxy.
- * There may be other, safe, kernels but this is not extensively tested yet.
- */
-# define HAVE_M_PULLDOWN
-# endif
-# if !defined(IPFILTER_LKM) && (__FreeBSD_version >= 300000)
-# include "opt_ipfilter.h"
-# endif
-# define COPYIN(a,b,c) copyin((caddr_t)(a), (caddr_t)(b), (c))
-# define COPYOUT(a,b,c) copyout((caddr_t)(a), (caddr_t)(b), (c))
-
-# if (__FreeBSD_version >= 500043)
-# define NETBSD_PF
-# endif
-# else
-# include <inttypes.h>
-# endif /* _KERNEL */
-
-# if (__FreeBSD_version >= 700000)
-# include <sys/selinfo.h>
-# endif
-# if (__FreeBSD_version >= 500043)
-# include <sys/mutex.h>
-# if (__FreeBSD_version >= 700014)
-# define KRWLOCK_FILL_SZ 36
-# define KMUTEX_FILL_SZ 24
-# include <sys/rwlock.h>
-# ifdef _KERNEL
-# define KMUTEX_T struct mtx
-# define KRWLOCK_T struct rwlock
-# define READ_ENTER(x) rw_rlock(&(x)->ipf_lk)
-# define WRITE_ENTER(x) rw_wlock(&(x)->ipf_lk)
-# define MUTEX_DOWNGRADE(x) rw_downgrade(&(x)->ipf_lk)
-# define RWLOCK_INIT(x,y) rw_init(&(x)->ipf_lk, (y))
-# define RW_DESTROY(x) rw_destroy(&(x)->ipf_lk)
-# define RWLOCK_EXIT(x) do { \
- if (rw_wowned(&(x)->ipf_lk)) \
- rw_wunlock(&(x)->ipf_lk); \
- else \
- rw_runlock(&(x)->ipf_lk); \
- } while (0)
-# endif
-# else
-# include <sys/sx.h>
-/*
- * Whilst the sx(9) locks on FreeBSD have the right semantics and interface
- * for what we want to use them for, despite testing showing they work -
- * with a WITNESS kernel, it generates LOR messages.
- */
-# if (__FreeBSD_version < 700000)
-# ifdef _KERNEL
-# define KMUTEX_T struct mtx
-# define KRWLOCK_T struct mtx
-# define READ_ENTER(x) mtx_lock(&(x)->ipf_lk)
-# define WRITE_ENTER(x) mtx_lock(&(x)->ipf_lk)
-# define RWLOCK_EXIT(x) mtx_unlock(&(x)->ipf_lk)
-# define MUTEX_DOWNGRADE(x) ;
-# define RWLOCK_INIT(x,y) mtx_init(&(x)->ipf_lk, (y), NULL,\
- MTX_DEF)
-# define RW_DESTROY(x) mtx_destroy(&(x)->ipf_lk)
-# endif
-# else
-# ifdef _KERNEL
-# define KRWLOCK_T struct sx
-# define KMUTEX_T struct mtx
-# define READ_ENTER(x) sx_slock(&(x)->ipf_lk)
-# define WRITE_ENTER(x) sx_xlock(&(x)->ipf_lk)
-# define MUTEX_DOWNGRADE(x) sx_downgrade(&(x)->ipf_lk)
-# define RWLOCK_INIT(x, y) sx_init(&(x)->ipf_lk, (y))
-# define RW_DESTROY(x) sx_destroy(&(x)->ipf_lk)
-# ifdef sx_unlock
-# define RWLOCK_EXIT(x) sx_unlock(&(x)->ipf_lk)
-# else
-# define RWLOCK_EXIT(x) do { \
- if ((x)->ipf_lk.sx_cnt < 0) \
- sx_xunlock(&(x)->ipf_lk); \
- else \
- sx_sunlock(&(x)->ipf_lk); \
- } while (0)
-# endif
-# endif
-# endif
-# endif
-# endif
-
-# if (__FreeBSD_version >= 501113)
-# include <net/if_var.h>
-# define IFNAME(x) ((struct ifnet *)x)->if_xname
-# define COPYIFNAME(v, x, b) \
- (void) strncpy(b, \
- ((struct ifnet *)x)->if_xname, \
- LIFNAMSIZ)
-# endif
-# if (__FreeBSD_version >= 500043)
-# else
-# define IFNAME(x) ((struct ifnet *)x)->if_name
-# endif
-
-# ifdef _KERNEL
-# define GETKTIME(x) microtime((struct timeval *)x)
-
-# if (__FreeBSD_version >= 500002)
-# include <netinet/in_systm.h>
-# include <netinet/ip.h>
-# include <machine/in_cksum.h>
-# endif
-
-# if (__FreeBSD_version >= 500043)
-# define USE_MUTEXES
-# define MUTEX_ENTER(x) mtx_lock(&(x)->ipf_lk)
-# define MUTEX_EXIT(x) mtx_unlock(&(x)->ipf_lk)
-# define MUTEX_INIT(x,y) mtx_init(&(x)->ipf_lk, (y), NULL,\
- MTX_DEF)
-# define MUTEX_DESTROY(x) mtx_destroy(&(x)->ipf_lk)
-# define MUTEX_NUKE(x) bzero((x), sizeof(*(x)))
-/*
- * Whilst the sx(9) locks on FreeBSD have the right semantics and interface
- * for what we want to use them for, despite testing showing they work -
- * with a WITNESS kernel, it generates LOR messages.
- */
-# include <machine/atomic.h>
-# define ATOMIC_INC(x) { mtx_lock(&softc->ipf_rw.ipf_lk); (x)++; \
- mtx_unlock(&softc->ipf_rw.ipf_lk); }
-# define ATOMIC_DEC(x) { mtx_lock(&softc->ipf_rw.ipf_lk); (x)--; \
- mtx_unlock(&softc->ipf_rw.ipf_lk); }
-# define ATOMIC_INCL(x) atomic_add_long(&(x), 1)
-# define ATOMIC_INC64(x) ATOMIC_INC(x)
-# define ATOMIC_INC32(x) atomic_add_32((u_int *)&(x), 1)
-# define ATOMIC_DECL(x) atomic_add_long(&(x), -1)
-# define ATOMIC_DEC64(x) ATOMIC_DEC(x)
-# define ATOMIC_DEC32(x) atomic_add_32((u_int *)&(x), -1)
-# define SPL_X(x) ;
-# define SPL_NET(x) ;
-# define SPL_IMP(x) ;
-# define SPL_SCHED(x) ;
-extern int in_cksum(struct mbuf *, int);
-# else
-# define SPL_SCHED(x) x = splhigh()
-# endif /* __FreeBSD_version >= 500043 */
-# if (__FreeBSD_version >= 500024)
-# define GET_MINOR dev2unit
-# endif
-# define MSGDSIZE(m) mbufchainlen(m)
-# define M_LEN(m) (m)->m_len
-# define M_ADJ(m,x) m_adj(m, x)
-# define M_COPY(x) m_copy((x), 0, M_COPYALL)
-# define M_DUP(m) m_dup(m, M_NOWAIT)
-# define IPF_PANIC(x,y) if (x) { printf y; panic("ipf_panic"); }
-typedef struct mbuf mb_t;
-# endif /* _KERNEL */
-
-# if __FreeBSD__ < 3
-# include <machine/spl.h>
-# else
-# if __FreeBSD__ == 3
-# if defined(IPFILTER_LKM) && !defined(ACTUALLY_LKM_NOT_KERNEL)
-# define ACTUALLY_LKM_NOT_KERNEL
-# endif
-# endif
-# endif
-
-# if (__FreeBSD_version >= 300000)
-typedef u_long ioctlcmd_t;
-# else
-typedef int ioctlcmd_t;
-# endif
-typedef struct uio uio_t;
-typedef int minor_t;
-typedef u_int32_t u_32_t;
-# define U_32_T 1
-
-# define OS_RECOGNISED 1
-#endif /* __FreeBSD__ */
-
-
-/* ----------------------------------------------------------------------- */
-/* O P E N B S D */
-/* ----------------------------------------------------------------------- */
-#ifdef __OpenBSD__
-# ifdef INET6
-# define USE_INET6
-# endif
-
-# ifdef _KERNEL
-# if !defined(IPFILTER_LKM)
-# include "bpfilter.h"
-# endif
-# if (OpenBSD >= 200311)
-# if defined(USE_INET6)
-# include "netinet6/in6_var.h"
-# include "netinet6/nd6.h"
-# endif
-# endif
-# if (OpenBSD >= 200012)
-# define HAVE_M_PULLDOWN 1
-# endif
-# define COPYIN(a,b,c) copyin((caddr_t)(a), (caddr_t)(b), (c))
-# define COPYOUT(a,b,c) copyout((caddr_t)(a), (caddr_t)(b), (c))
-# define GETKTIME(x) microtime((struct timeval *)x)
-# define MSGDSIZE(m) mbufchainlen(m)
-# define M_LEN(m) (m)->m_len
-# define M_ADJ(m,x) m_adj(m, x)
-# define M_COPY(m) m_copy((m), 0, M_COPYALL)
-# define IPF_PANIC(x,y) if (x) { printf y; panic("ipf_panic"); }
-typedef struct mbuf mb_t;
-# endif /* _KERNEL */
-# if (OpenBSD >= 199603)
-# define IFNAME(x, b) ((struct ifnet *)x)->if_xname
-# define COPYIFNAME(v, x, b) \
- (void) strncpy(b, \
- ((struct ifnet *)x)->if_xname, \
- LIFNAMSIZ)
-# else
-# define IFNAME(x) ((struct ifnet *)x)->if_name
-# endif
-typedef struct uio uio_t;
-typedef u_long ioctlcmd_t;
-typedef int minor_t;
-typedef u_int32_t u_32_t;
-# define U_32_T 1
-
-# define OS_RECOGNISED 1
-#endif /* __OpenBSD__ */
-
-
-/* ----------------------------------------------------------------------- */
-/* B S D O S */
-/* ----------------------------------------------------------------------- */
-#ifdef _BSDI_VERSION
-# ifdef INET6
-# define USE_INET6
-# endif
-
-# ifdef _KERNEL
-# define GETKTIME(x) microtime((struct timeval *)x)
-# define MSGDSIZE(m) mbufchainlen(m)
-# define M_LEN(m) (m)->m_len
-# define M_ADJ(m,x) m_adj(m, x)
-# define M_COPY(m) m_copy((m), 0, M_COPYALL)
-# define IFNAME(x) ((struct ifnet *)x)->if_name
-typedef struct mbuf mb_t;
-# endif /* _KERNEL */
-
-# if (_BSDI_VERSION >= 199701)
-typedef u_long ioctlcmd_t;
-# else
-typedef int ioctlcmd_t;
-# endif
-typedef u_int32_t u_32_t;
-# define U_32_T 1
-
-#endif /* _BSDI_VERSION */
-
-
-/* ----------------------------------------------------------------------- */
-/* S U N O S 4 */
-/* ----------------------------------------------------------------------- */
-#if defined(sun) && !defined(OS_RECOGNISED) /* SunOS4 */
-# ifdef _KERNEL
-# include <sys/kmem_alloc.h>
-# define GETKTIME(x) uniqtime((struct timeval *)x)
-# define MSGDSIZE(m) mbufchainlen(m)
-# define M_LEN(m) (m)->m_len
-# define M_ADJ(m,x) m_adj(m, x)
-# define M_COPY(m) m_copy((m), 0, M_COPYALL)
-# define IFNAME(x) ((struct ifnet *)x)->if_name
-# define GETIFP(n, v) ifunit(n, IFNAMSIZ)
-# define GETIFMTU_4(x) ((struct ifnet *)x)->if_mtu
-# define KFREE(x) kmem_free((char *)(x), sizeof(*(x)))
-# define KFREES(x,s) kmem_free((char *)(x), (s))
-# define SLEEP(id, n) sleep((id), PZERO+1)
-# define WAKEUP(id,x) wakeup(id + x)
-# define POLLWAKEUP(x) ;
-# define UIOMOVE(a,b,c,d) uiomove((void *)a,b,c,d)
-# define IPF_PANIC(x,y) if (x) { printf y; panic("ipf_panic"); }
-
-extern void m_copydata(struct mbuf *, int, int, void *);
-extern void m_copyback(struct mbuf *, int, int, void *);
-
-typedef struct mbuf mb_t;
-# endif
-
-typedef struct uio uio_t;
-typedef int ioctlcmd_t;
-typedef int minor_t;
-typedef unsigned int u_32_t;
-# define U_32_T 1
-
-# define OS_RECOGNISED 1
-
-#endif /* SunOS 4 */
-
-/* ----------------------------------------------------------------------- */
-/* L I N U X */
-/* ----------------------------------------------------------------------- */
-#if defined(linux) && !defined(OS_RECOGNISED)
-# include <linux/version.h>
-# if (LINUX >= 20600) && defined(_KERNEL)
-# define HDR_T_PRIVATE 1
-# endif
-# undef USE_INET6
-# ifdef USE_INET6
-struct ip6_ext {
- u_char ip6e_nxt;
- u_char ip6e_len;
-};
-# endif
-
-# ifdef _KERNEL
-# include <asm/byteorder.h>
-# ifdef __LITTLE_ENDIAN
-# define BIG_ENDIAN 0
-# define LITTLE_ENDIAN 1
-# define BYTE_ORDER LITTLE_ENDIAN
-# else
-# define BIG_ENDIAN 1
-# define LITTLE_ENDIAN 0
-# define BYTE_ORDER BIG_ENDIAN
-# endif
-# define IPF_PANIC(x,y) if (x) { printf y; panic("ipf_panic"); }
-# define COPYIN(a,b,c) copy_from_user((caddr_t)(b), (caddr_t)(a), (c))
-# define COPYOUT(a,b,c) copy_to_user((caddr_t)(b), (caddr_t)(a), (c))
-# define FREE_MB_T(m) kfree_skb(m)
-# define GETKTIME(x) do_gettimeofday((struct timeval *)x)
-# define POLLWAKEUP(x) ;
-# ifdef wait_event_interruptible
-# define SLEEP(x,s) wait_event_interruptible((*(x##_linux)), 0)
-# else
-# define SLEEP(x,s) 0, interruptible_sleep_on(x##_linux)
-# endif
-# define WAKEUP(x,y) wake_up(x##_linux + y)
-# define UIOMOVE(a,b,c,d) uiomove((caddr_t)a,b,c,d)
-# define USE_MUTEXES
-# define KRWLOCK_T rwlock_t
-# define KMUTEX_T spinlock_t
-# define MUTEX_INIT(x,y) spin_lock_init(&(x)->ipf_lk)
-# define MUTEX_ENTER(x) spin_lock_bh(&(x)->ipf_lk)
-# define MUTEX_EXIT(x) spin_unlock_bh(&(x)->ipf_lk)
-# define MUTEX_DESTROY(x) do { } while (0)
-# define MUTEX_NUKE(x) bzero(&(x)->ipf_lk, sizeof((x)->ipf_lk))
-# define READ_ENTER(x) ipf_read_enter(x)
-# define WRITE_ENTER(x) ipf_write_enter(x)
-# define RWLOCK_INIT(x,y) ipf_rw_init(x, y)
-# define RW_DESTROY(x) do { } while (0)
-# define RWLOCK_EXIT(x) ipf_rw_exit(x)
-# define MUTEX_DOWNGRADE(x) ipf_rw_downgrade(x)
-# define ATOMIC_INCL(x) atomic_long_inc((atomic_long_t *)&(x))
-# define ATOMIC_DECL(x) atomic_long_dec((atomic_long_t *)&(x))
-# define ATOMIC_INC32(x) atomic_inc((atomic_t *)&(x))
-# define ATOMIC_DEC32(x) atomic_dec((atomic_t *)&(x))
-# ifdef CONFIG_X86_32
-# define ATOMIC_INC64(x) do { MUTEX_ENTER(&softc->ipf_rw); \
- (x)++; \
- MUTEX_EXIT(&softc->ipf_rw); \
- } while (0)
-# define ATOMIC_DEC64(x) do { MUTEX_ENTER(&softc->ipf_rw); \
- (x)--; \
- MUTEX_EXIT(&softc->ipf_rw); \
- } while (0)
-# else
-# define ATOMIC_INC64(x) atomic64_inc((atomic64_t *)&(x))
-# define ATOMIC_DEC64(x) atomic64_dec((atomic64_t *)&(x))
-# endif
-# define U_QUAD_T u_int64_t
-# define QUAD_T int64_t
-# define SPL_SCHED(x) do { } while (0)
-# define SPL_IMP(x) do { } while (0)
-# define SPL_NET(x) do { } while (0)
-# define SPL_X(x) do { } while (0)
-# define IFNAME(x) ((struct net_device*)x)->name
-typedef struct sk_buff mb_t;
-extern void m_copydata(mb_t *, int, int, void *);
-extern void m_copyback(mb_t *, int, int, void *);
-extern void m_adj(mb_t *, int);
-extern mb_t *m_pullup(mb_t *, int);
-# define mbuf sk_buff
-
-# define mtod(m, t) ((t)(m)->data)
-# define m_adj(m, x) skb_trim((m), (m)->len + (x))
-# define m_data data
-# define m_len len
-# define m_next next
-# define M_COPY(m) skb_clone((m), in_interrupt() ? GFP_ATOMIC : \
- GFP_KERNEL)
-# define MSGDSIZE(m) (m)->len
-# define M_LEN(m) (m)->len
-# define M_ADJ(m,x) m_adj(m, x)
-# define M_DUP(m) skb_copy((m), in_interrupt() ? GFP_ATOMIC : \
- GFP_KERNEL)
-# define PREP_MB_T(f, m) do { \
- (m)->next = *(f)->fin_mp; \
- *(fin)->fin_mp = (m); \
- (f)->fin_m = (m); \
- } while (0)
-# define ALLOC_MB_T(m,l) (m) = alloc_skb((l), \
- in_interrupt() ? GFP_ATOMIC : \
- GFP_KERNEL)
-
-# define splnet(x) ;
-# define printf printk
-# define bcopy(s,d,z) memmove(d, s, z)
-# define bzero(s,z) memset(s, 0, z)
-# define bcmp(a,b,z) memcmp(a, b, z)
-# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
-# define ipf_random random32
-# define arc4random random32
-# else
-# include <linux/random.h>
-# define ipf_random get_random_int
-# define arc4random get_random_int
-# endif
-
-# define ifnet net_device
-# define if_xname name
-# define if_unit ifindex
-
-# define KMALLOC(x,t) (x) = (t)kmalloc(sizeof(*(x)), \
- in_interrupt() ? GFP_ATOMIC : GFP_KERNEL)
-# define KFREE(x) kfree(x)
-# define KMALLOCS(x,t,s) (x) = (t)kmalloc((s), \
- in_interrupt() ? GFP_ATOMIC : GFP_KERNEL)
-# define KFREES(x,s) kfree(x)
-
-# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
-# define f_uid f_owner.uid
-# define GETIFP(n,v) dev_get_by_name(&init_net, n)
-# else
-# define GETIFP(n,v) dev_get_by_name(n)
-# endif
-# define GETIFMTU_4(x) ((struct net_device *)x)->mtu
-# define GETIFMTU_6(x) ((struct net_device *)x)->mtu
-
-# else
-# include <net/ethernet.h>
-
-struct mbuf {
-};
-
-# ifndef _NET_ROUTE_H
-struct rtentry {
-};
-# endif
-
-struct ifnet {
- char if_xname[IFNAMSIZ];
- int if_unit;
- int (* if_output)(struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *);
- struct ifaddr *if_addrlist;
-};
-# define IFNAME(x) ((struct ifnet *)x)->if_xname
-
-# endif /* _KERNEL */
-
-# define COPYIFNAME(v, x, b) \
- (void) strncpy(b, \
- ((struct ifnet *)x)->if_xname, \
- LIFNAMSIZ)
-
-# include <linux/fs.h>
-# define FWRITE FMODE_WRITE
-# define FREAD FMODE_READ
-
-# define __USE_MISC 1
-# define __FAVOR_BSD 1
-
-typedef struct uio {
- struct iovec *uio_iov;
- void *uio_file;
- char *uio_buf;
- int uio_iovcnt;
- int uio_offset;
- size_t uio_resid;
- int uio_rw;
-} uio_t;
-
-extern int uiomove(void *, size_t, int, struct uio *);
-
-# define UIO_READ 1
-# define UIO_WRITE 2
-
-# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)) && !defined(_KERNEL)
-typedef int fmode_t;
-# endif
-
-typedef u_long ioctlcmd_t;
-typedef int minor_t;
-typedef u_int32_t u_32_t;
-# define U_32_T 1
-
-# define OS_RECOGNISED 1
-
-#endif
-
-
-/* ----------------------------------------------------------------------- */
-/* A I X */
-/* ----------------------------------------------------------------------- */
-#if defined(_AIX51)
-# undef MENTAT
-
-# include <sys/lock.h>
-# include <sys/sysmacros.h>
-
-# ifdef _KERNEL
-# define rw_read_locked(x) 0
-# include <net/net_globals.h>
-# include <net/net_malloc.h>
-# define KMUTEX_T simple_lock_t
-# define KRWLOCK_T complex_lock_t
-# define USE_MUTEXES 1
-# define USE_SPL 1
-# define READ_ENTER(x) lock_read((x)->ipf_lk)
-# define WRITE_ENTER(x) lock_write((x)->ipf_lk)
-# define MUTEX_DOWNGRADE(x) lock_write_to_read((x)->ipf_lk)
-# define RWLOCK_INIT(x, y) lock_alloc(&(x)->ipf_lk, \
- LOCK_ALLOC_PIN, \
- (u_short)y, 0); \
- lock_init((x)->ipf_lk, TRUE)
-# define RWLOCK_EXIT(x) lock_done((x)->ipf_lk)
-# define RW_DESTROY(x) lock_free(&(x)->ipf_lk)
-# define MUTEX_ENTER(x) simple_lock((x)->ipf_lk)
-# define MUTEX_INIT(x, y) lock_alloc(&(x)->ipf_lk, \
- LOCK_ALLOC_PIN, \
- (u_short)y, 0); \
- simple_lock_init((x)->ipf_lk)
-# define MUTEX_DESTROY(x) lock_free(&(x)->ipf_lk)
-# define MUTEX_EXIT(x) simple_unlock((x)->ipf_lk)
-# define MUTEX_NUKE(x) bzero(&(x)->ipf_lk, sizeof((x)->ipf_lk))
-# define ATOMIC_INC64(x) { MUTEX_ENTER(&softc->ipf_rw); (x)++; \
- MUTEX_EXIT(&softc->ipf_rw); }
-# define ATOMIC_DEC64(x) { MUTEX_ENTER(&softc->ipf_rw); (x)--; \
- MUTEX_EXIT(&softc->ipf_rw); }
-# define ATOMIC_INC32(x) { MUTEX_ENTER(&softc->ipf_rw); (x)++; \
- MUTEX_EXIT(&softc->ipf_rw); }
-# define ATOMIC_DEC32(x) { MUTEX_ENTER(&softc->ipf_rw); (x)--; \
- MUTEX_EXIT(&softc->ipf_rw); }
-# define ATOMIC_INCL(x) { MUTEX_ENTER(&softc->ipf_rw); (x)++; \
- MUTEX_EXIT(&softc->ipf_rw); }
-# define ATOMIC_DECL(x) { MUTEX_ENTER(&softc->ipf_rw); (x)--; \
- MUTEX_EXIT(&softc->ipf_rw); }
-# define ATOMIC_INC(x) { MUTEX_ENTER(&softc->ipf_rw); (x)++; \
- MUTEX_EXIT(&softc->ipf_rw); }
-# define ATOMIC_DEC(x) { MUTEX_ENTER(&softc->ipf_rw); (x)--; \
- MUTEX_EXIT(&softc->ipf_rw); }
-# define SPL_SCHED(x) x = splsched()
-# define SPL_NET(x) x = splnet()
-# define SPL_IMP(x) x = splimp()
-# undef SPL_X
-# define SPL_X(x) splx(x)
-# define UIOMOVE(a,b,c,d) uiomove((void *)a,b,c,d)
-extern void* getifp(char *, int);
-# define GETIFP(n, v) getifp(n, v)
-# define GETIFMTU_4(x) ((struct ifnet *)x)->if_mtu
-# define GETIFMTU_6(x) ((struct ifnet *)x)->if_mtu
-# define GET_MINOR minor
-# define SLEEP(id, n) sleepx((id), PZERO+1, 0)
-# define WAKEUP(id,x) wakeup(id)
-# define POLLWAKEUP(x) ;
-# define COPYIN(a,b,c) copyin((caddr_t)(a), (caddr_t)(b), (c))
-# define COPYOUT(a,b,c) copyout((caddr_t)(a), (caddr_t)(b), (c))
-# define KMALLOC(a, b) MALLOC((a), b, sizeof(*(a)), M_TEMP, M_NOWAIT)
-# define KMALLOCS(a, b, c) MALLOC((a), b, (c), M_TEMP, \
- ((c) > 4096) ? M_WAITOK : M_NOWAIT)
-# define KFREE(x) FREE((x), M_TEMP)
-# define KFREES(x,s) FREE((x), M_TEMP)
-# define MSGDSIZE(m) mbufchainlen(m)
-# define M_LEN(m) (m)->m_len
-# define M_ADJ(m,x) m_adj(m, x)
-# define M_COPY(m) m_copy((m), 0, M_COPYALL)
-# define GETKTIME(x)
-# define IPF_PANIC(x,y)
-typedef struct mbuf mb_t;
-# endif /* _KERNEL */
-
-/*
- * These are from's Solaris' #defines for little endian.
- */
-#if !defined(IP6F_MORE_FRAG)
-# define IP6F_MORE_FRAG 0x0100
-#endif
-#if !defined(IP6F_RESERVED_MASK)
-# define IP6F_RESERVED_MASK 0x0600
-#endif
-#if !defined(IP6F_OFF_MASK)
-# define IP6F_OFF_MASK 0xf8ff
-#endif
-
-struct ip6_ext {
- u_char ip6e_nxt;
- u_char ip6e_len;
-};
-
-typedef int ioctlcmd_t;
-typedef int minor_t;
-/*
- * Really, any arch where sizeof(long) != sizeof(int).
- */
-typedef unsigned int u_32_t;
-# define U_32_T 1
-
-# define OS_RECOGNISED 1
-#endif /* _AIX51 */
-
-
-#ifndef OS_RECOGNISED
-#error ip_compat.h does not recognise this platform/OS.
-#endif
-
-
/* ----------------------------------------------------------------------- */
/* G E N E R I C */
/* ----------------------------------------------------------------------- */
-#ifndef OS_RECOGNISED
-#endif
/*
* For BSD kernels, if bpf is in the kernel, enable ipfilter to use bpf in