making wireguard work on RHEL7/etc.

wireguard at wut.to wireguard at wut.to
Sat Jun 24 17:18:51 CEST 2017


hello,

the two diffs attached (hopefully not eaten by mailman) made wireguard
work for me on Scientific Linux 7.3 and CentOS Linux 7.3.1611

hopefully they are useful for other people

they were patched against the source installed by
wireguard-dkms-0.0.20170613-1.el7.centos.noarch in /usr/src/wireguard-*

also available here:

https://pastebin.com/uWGWuF8f
https://pastebin.com/P3VqR1H6
-------------- next part --------------
--- compat/compat.h.orig	2017-06-13 16:33:26.000000000 +0100
+++ compat/compat.h	2017-06-24 15:28:38.866637683 +0100
@@ -7,6 +7,9 @@
 #include <linux/version.h>
 #include <linux/types.h>
 
+#undef  LINUX_VERSION_CODE
+#define LINUX_VERSION_CODE KERNEL_VERSION(3, 18, 0)
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
 #error "WireGuard requires Linux >= 3.10"
 #endif
@@ -29,9 +32,9 @@
 #define headers_end data
 #endif
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)
-#include "udp_tunnel/udp_tunnel_partial_compat.h"
-#endif
+//#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)
+//#include "udp_tunnel/udp_tunnel_partial_compat.h"
+//#endif
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) && !defined(DEBUG) && defined(net_dbg_ratelimited)
 #undef net_dbg_ratelimited
@@ -43,14 +46,14 @@
 #endif
 
 #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)
-#define dev_recursion_level() 0
+   (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)
+//#define dev_recursion_level() 0
 #endif
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
-#define ipv6_dst_lookup(a, b, c, d) ipv6_dst_lookup(b, c, d)
+//#define ipv6_dst_lookup(a, b, c, d) ipv6_dst_lookup(b, c, d)
 #endif
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 5) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)) || \
@@ -149,7 +152,7 @@
 })
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
+//#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
 #include "checksum/checksum_partial_compat.h"
 static inline void *our_pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len)
 {
@@ -160,7 +163,7 @@
 	return skb_put(tail, len);
 }
 #define pskb_put our_pskb_put
-#endif
+//#endif
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)
 #include <net/xfrm.h>
-------------- next part --------------
--- compat/siphash/siphash.c	2017-06-24 15:32:19.139482133 +0100
+++ compat/siphash/siphash.c	2017-06-24 15:30:09.205021457 +0100
@@ -13,7 +13,7 @@
 #include <linux/siphash.h>
 #include <asm/unaligned.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
+//#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
 #ifdef __LITTLE_ENDIAN
  #define HASH_LEN_DECLARE u32 hash; u32 len;
  #define bytemask_from_count(cnt)	(~(~0ul << (cnt)*8))
@@ -21,7 +21,7 @@
  #define HASH_LEN_DECLARE u32 len; u32 hash;
  #define bytemask_from_count(cnt)	(~(~0ul >> (cnt)*8))
 #endif
-#endif
+//#endif
 
 #if defined(CONFIG_DCACHE_WORD_ACCESS) && BITS_PER_LONG == 64
 #include <linux/dcache.h>


More information about the WireGuard mailing list