/freeswan/klips/net/ipsec/ipsec_kversion.h
C Header | 187 lines | 109 code | 29 blank | 49 comment | 2 complexity | 6fc182ddec13e7b01b7cb441a9a3fe92 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, MPL-2.0-no-copyleft-exception, LGPL-3.0, Unlicense, GPL-2.0, GPL-3.0, CC-BY-SA-3.0, AGPL-1.0, ISC, MIT, 0BSD, LGPL-2.0
- #ifndef _FREESWAN_KVERSIONS_H
- /*
- * header file for FreeS/WAN library functions
- * Copyright (C) 1998, 1999, 2000 Henry Spencer.
- * Copyright (C) 1999, 2000, 2001 Richard Guy Briggs
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version. See <http://www.fsf.org/copyleft/lgpl.txt>.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
- * License for more details.
- *
- * RCSID $Id: ipsec_kversion.h,v 1.2.2.1 2002/04/12 03:21:43 mcr Exp $
- */
- #define _FREESWAN_KVERSIONS_H /* seen it, no need to see it again */
- /*
- * this file contains a series of atomic defines that depend upon
- * kernel version numbers. The kernel versions are arranged
- * in version-order number (which is often not chronological)
- * and each clause enables or disables a feature.
- */
- /*
- * First, assorted kernel-version-dependent trickery.
- */
- #include <linux/version.h>
- #ifndef KERNEL_VERSION
- #define KERNEL_VERSION(x,y,z) (((x)<<16)+((y)<<8)+(z))
- #endif
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)
- #define HEADER_CACHE_BIND_21
- #endif
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
- #define SPINLOCK
- #define PROC_FS_21
- #define NETLINK_SOCK
- #define NET_21
- #endif
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,19)
- #define net_device_stats enet_statistics
- #endif
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)
- #define SPINLOCK_23
- #define NETDEV_23
- # ifndef CONFIG_IP_ALIAS
- # define CONFIG_IP_ALIAS
- # endif
- #endif
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,25)
- #define PROC_FS_2325
- #undef PROC_FS_21
- #endif
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,30)
- #define PROC_NO_DUMMY
- #endif
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,35)
- #define SKB_COPY_EXPAND
- #endif
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,37)
- #define IP_SELECT_IDENT
- #endif
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,50)) && defined(CONFIG_NETFILTER)
- #define SKB_RESET_NFCT
- #endif
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,2)
- #define IP_SELECT_IDENT_NEW
- #endif
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,4)
- #define IPH_is_SKB_PULLED
- #define SKB_COW_NEW
- #define PROTO_HANDLER_SINGLE_PARM
- #define IP_FRAGMENT_LINEARIZE 1
- #else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,4) */
- # ifdef REDHAT_BOGOSITY
- # define IP_SELECT_IDENT_NEW
- # define IPH_is_SKB_PULLED
- # define SKB_COW_NEW
- # define PROTO_HANDLER_SINGLE_PARM
- # endif /* REDHAT_BOGOSITY */
- #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,4) */
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,9)
- #define MALLOC_SLAB
- #define LINUX_KERNEL_HAS_SNPRINTF
- #endif
- #ifdef NET_21
- # include <linux/in6.h>
- #else
- /* old kernel in.h has some IPv6 stuff, but not quite enough */
- # define s6_addr16 s6_addr
- # define AF_INET6 10
- # define uint8_t __u8
- # define uint16_t __u16
- # define uint32_t __u32
- # define uint64_t __u64
- #endif
- #ifndef SPINLOCK
- # include <linux/bios32.h>
- /* simulate spin locks and read/write locks */
- typedef struct {
- volatile char lock;
- } spinlock_t;
- typedef struct {
- volatile unsigned int lock;
- } rwlock_t;
- # define spin_lock_init(x) { (x)->lock = 0;}
- # define rw_lock_init(x) { (x)->lock = 0; }
- # define spin_lock(x) { while ((x)->lock) barrier(); (x)->lock=1;}
- # define spin_lock_irq(x) { cli(); spin_lock(x);}
- # define spin_lock_irqsave(x,flags) { save_flags(flags); spin_lock_irq(x);}
- # define spin_unlock(x) { (x)->lock=0;}
- # define spin_unlock_irq(x) { spin_unlock(x); sti();}
- # define spin_unlock_irqrestore(x,flags) { spin_unlock(x); restore_flags(flags);}
- # define read_lock(x) spin_lock(x)
- # define read_lock_irq(x) spin_lock_irq(x)
- # define read_lock_irqsave(x,flags) spin_lock_irqsave(x,flags)
- # define read_unlock(x) spin_unlock(x)
- # define read_unlock_irq(x) spin_unlock_irq(x)
- # define read_unlock_irqrestore(x,flags) spin_unlock_irqrestore(x,flags)
- # define write_lock(x) spin_lock(x)
- # define write_lock_irq(x) spin_lock_irq(x)
- # define write_lock_irqsave(x,flags) spin_lock_irqsave(x,flags)
- # define write_unlock(x) spin_unlock(x)
- # define write_unlock_irq(x) spin_unlock_irq(x)
- # define write_unlock_irqrestore(x,flags) spin_unlock_irqrestore(x,flags)
- #endif /* !SPINLOCK */
- #ifndef SPINLOCK_23
- # define spin_lock_bh(x) spin_lock_irq(x)
- # define spin_unlock_bh(x) spin_unlock_irq(x)
- # define read_lock_bh(x) read_lock_irq(x)
- # define read_unlock_bh(x) read_unlock_irq(x)
- # define write_lock_bh(x) write_lock_irq(x)
- # define write_unlock_bh(x) write_unlock_irq(x)
- #endif /* !SPINLOCK_23 */
- #endif /* _FREESWAN_KVERSIONS_H */
- /*
- * $Log: ipsec_kversion.h,v $
- * Revision 1.2.2.1 2002/04/12 03:21:43 mcr
- * fixes for compilation on RH 7.1
- *
- * Revision 1.3 2002/04/12 03:21:17 mcr
- * three parameter version of ip_select_ident appears first
- * in 2.4.2 (RH7.1) not 2.4.4.
- *
- * Revision 1.2 2002/03/08 21:35:22 rgb
- * Defined LINUX_KERNEL_HAS_SNPRINTF to shut up compiler warnings after
- * 2.4.9. (Andreas Piesk).
- *
- * Revision 1.1 2002/01/29 02:11:42 mcr
- * removal of kversions.h - sources that needed it now use ipsec_param.h.
- * updating of IPv6 structures to match latest in6.h version.
- * removed dead code from freeswan.h that also duplicated kversions.h
- * code.
- *
- *
- */