From c99d224956eb398b412eba65d044ab5a3786914c Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 28 Jun 2017 02:27:42 +0200 Subject: compat: support EL7.3 --- src/compat/compat.h | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/compat/compat.h b/src/compat/compat.h index 159abb1..4e979f7 100644 --- a/src/compat/compat.h +++ b/src/compat/compat.h @@ -7,6 +7,12 @@ #include #include +#ifdef RHEL_MAJOR +#if RHEL_MAJOR == 7 +#define ISRHEL7 +#endif +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0) #error "WireGuard requires Linux >= 3.10" #endif @@ -15,7 +21,7 @@ #define CONFIG_AS_SSSE3 #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) && !defined(ISRHEL7) #define headers_start data #define headers_end data #endif @@ -33,14 +39,14 @@ #define RCU_LOCKDEP_WARN(cond, message) rcu_lockdep_assert(!(cond), message) #endif -#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 19, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 6)) || \ +#if ((LINUX_VERSION_CODE > KERNEL_VERSION(3, 19, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 6)) || \ (LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 12) && LINUX_VERSION_CODE > KERNEL_VERSION(3, 17, 0)) || \ (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 8) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) || \ - LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 40) + LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 40)) && !defined(ISRHEL7) #define dev_recursion_level() 0 #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) && !defined(ISRHEL7) #define ipv6_dst_lookup(a, b, c, d) ipv6_dst_lookup(b, c, d) #endif @@ -50,7 +56,6 @@ (LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 8) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) || \ (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 40) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0)) || \ (LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 54)) - #include #include #define IP6_ECN_set_ce(a, b) IP6_ECN_set_ce(b) @@ -63,7 +68,7 @@ #define time_is_after_eq_jiffies64(a) time_before_eq64(get_jiffies_64(), a) #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) && IS_ENABLED(CONFIG_IPV6) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) && IS_ENABLED(CONFIG_IPV6) && !defined(ISRHEL7) #include struct ipv6_stub_type { void *udpv6_encap_enable; @@ -114,17 +119,17 @@ static inline u32 get_random_u32(void) } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) && !defined(ISRHEL7) static inline void netif_keep_dst(struct net_device *dev) { dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) && !defined(ISRHEL7) #define pcpu_sw_netstats pcpu_tstats #define netdev_alloc_pcpu_stats alloc_percpu -#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) +#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) && !defined(ISRHEL7) #define netdev_alloc_pcpu_stats(type) \ ({ \ typeof(type) __percpu *pcpu_stats = alloc_percpu(type); \ @@ -153,7 +158,7 @@ static inline void *our_pskb_put(struct sk_buff *skb, struct sk_buff *tail, int #define pskb_put our_pskb_put #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) && !defined(ISRHEL7) #include static inline void skb_scrub_packet(struct sk_buff *skb, bool xnet) { @@ -175,7 +180,7 @@ static inline void skb_scrub_packet(struct sk_buff *skb, bool xnet) } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) && !defined(ISRHEL7) #include static inline u32 prandom_u32_max(u32 ep_ro) { @@ -183,7 +188,7 @@ static inline u32 prandom_u32_max(u32 ep_ro) } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 75) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 75) && !defined(ISRHEL7) #define U8_MAX ((u8)~0U) #define S8_MAX ((s8)(U8_MAX >> 1)) #define S8_MIN ((s8)(-S8_MAX - 1)) @@ -198,7 +203,7 @@ static inline u32 prandom_u32_max(u32 ep_ro) #define S64_MIN ((s64)(-S64_MAX - 1)) #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 60) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 60) && !defined(ISRHEL7) /* Making this static may very well invalidate its usefulness, * but so it goes with compat code. */ static inline void memzero_explicit(void *s, size_t count) @@ -208,7 +213,7 @@ static inline void memzero_explicit(void *s, size_t count) } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) && !defined(ISRHEL7) static const struct in6_addr our_in6addr_any = IN6ADDR_ANY_INIT; #define in6addr_any our_in6addr_any #endif @@ -267,11 +272,11 @@ static inline int get_random_bytes_wait(void *buf, int nbytes) } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) && !defined(ISRHEL7) #define system_power_efficient_wq system_unbound_wq #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) && !defined(ISRHEL7) #include static inline u64 ktime_get_ns(void) { -- cgit v1.2.3-59-g8ed1b