Development discussion of WireGuard
 help / color / mirror / Atom feed
* fix centos 6 compile
@ 2017-06-19 17:44 Lucian Cristian
  2017-06-26 12:43 ` Lucian Cristian
  0 siblings, 1 reply; 4+ messages in thread
From: Lucian Cristian @ 2017-06-19 17:44 UTC (permalink / raw)
  To: WireGuard mailing list

[-- Attachment #1: Type: text/plain, Size: 129 bytes --]

centos 6 has gcc 4.4.7

with some minor modification and the updated kernel from elrepo this is 
working as it should


Regards


[-- Attachment #2: fix_gcc_centos_6.patch --]
[-- Type: text/plain, Size: 2000 bytes --]

diff -aur WireGuard-0.0.20170613/src/socket.c WireGuard-0.0.20170613-cnt6/src/socket.c
--- WireGuard-0.0.20170613/src/socket.c	2017-06-13 01:18:14.000000000 +0300
+++ WireGuard-0.0.20170613/src/socket.c	2017-06-19 20:36:58.997018769 +0300
@@ -12,6 +12,9 @@
 #include <linux/if_ether.h>
 #include <net/udp_tunnel.h>
 #include <net/ipv6.h>
+#define GCC_VERSION (__GNUC__ * 10000 \
+		    + __GNUC_MINOR__ * 100 \
+		    + __GNUC_PATCHLEVEL__)
 
 static inline int send4(struct wireguard_device *wg, struct sk_buff *skb, struct endpoint *endpoint, u8 ds, struct dst_cache *cache)
 {
@@ -307,7 +310,10 @@
 	struct socket *new4 = NULL;
 	struct udp_port_cfg port4 = {
 		.family = AF_INET,
+/* Test for GCC > 4.4.7 */
+#if GCC_VERSION > 40407
 		.local_ip.s_addr = htonl(INADDR_ANY),
+#endif
 		.local_udp_port = htons(wg->incoming_port),
 		.use_udp_checksums = true
 	};
@@ -316,7 +322,10 @@
 	struct socket *new6 = NULL;
 	struct udp_port_cfg port6 = {
 		.family = AF_INET6,
+/* Test for GCC > 4.4.7 */
+#if GCC_VERSION > 40407
 		.local_ip6 = IN6ADDR_ANY_INIT,
+#endif
 		.local_udp_port = htons(wg->incoming_port),
 		.use_udp6_tx_checksums = true,
 		.use_udp6_rx_checksums = true,
diff -aur WireGuard-0.0.20170613/src/tools/Makefile WireGuard-0.0.20170613-cnt6/src/tools/Makefile
--- WireGuard-0.0.20170613/src/tools/Makefile	2017-06-13 01:18:14.000000000 +0300
+++ WireGuard-0.0.20170613/src/tools/Makefile	2017-06-19 20:19:42.560467226 +0300
@@ -11,6 +11,8 @@
 WITH_BASHCOMPLETION ?=
 WITH_WGQUICK ?=
 WITH_SYSTEMDUNITS ?=
+GCC_EQ_447 := $(shell expr `gcc -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/'` \= 40407)
+
 
 ifeq ($(WITH_BASHCOMPLETION),)
 ifneq ($(strip $(wildcard $(BASHCOMPDIR))),)
@@ -32,7 +34,11 @@
 endif
 
 CFLAGS ?= -O3
+ifeq "$(GCC_EQ_447)" "1"
+CFLAGS += -std=gnu99 -D_GNU_SOURCE
+else
 CFLAGS += -std=gnu11 -D_GNU_SOURCE
+endif
 CFLAGS += -Wall -Wextra
 CFLAGS += -MMD -MP
 CFLAGS += -DRUNSTATEDIR="\"$(RUNSTATEDIR)\""

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: fix centos 6 compile
  2017-06-19 17:44 fix centos 6 compile Lucian Cristian
@ 2017-06-26 12:43 ` Lucian Cristian
  2017-06-27 20:59   ` Jason A. Donenfeld
  0 siblings, 1 reply; 4+ messages in thread
From: Lucian Cristian @ 2017-06-26 12:43 UTC (permalink / raw)
  To: wireguard

[-- Attachment #1: Type: text/plain, Size: 464 bytes --]

just reminding of this as I didn't see any input about it
REHL 6 is EOL in 2020 and this is a minor change

Regards

On 19.06.2017 20:44, Lucian Cristian wrote:
> centos 6 has gcc 4.4.7
>
> with some minor modification and the updated kernel from elrepo this 
> is working as it should
>
>
> Regards
>
>
>
> _______________________________________________
> WireGuard mailing list
> WireGuard@lists.zx2c4.com
> https://lists.zx2c4.com/mailman/listinfo/wireguard



[-- Attachment #2: Type: text/html, Size: 1208 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: fix centos 6 compile
  2017-06-26 12:43 ` Lucian Cristian
@ 2017-06-27 20:59   ` Jason A. Donenfeld
  2017-06-27 21:24     ` Lucian Cristian
  0 siblings, 1 reply; 4+ messages in thread
From: Jason A. Donenfeld @ 2017-06-27 20:59 UTC (permalink / raw)
  To: Lucian Cristian; +Cc: WireGuard mailing list

Isn't EL6 still on 2.6.32, which is far away from the 3.10 that
WireGuard requires? In that case you'll be running with a custom
kernel. Why can't you just update your gcc from the same external
repo, at the same time?

I just backported to EL7.3 and felt nauseous the whole time. Not sure
I have the stomach for EL6...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: fix centos 6 compile
  2017-06-27 20:59   ` Jason A. Donenfeld
@ 2017-06-27 21:24     ` Lucian Cristian
  0 siblings, 0 replies; 4+ messages in thread
From: Lucian Cristian @ 2017-06-27 21:24 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: WireGuard mailing list

On 27.06.2017 23:59, Jason A. Donenfeld wrote:
> Isn't EL6 still on 2.6.32, which is far away from the 3.10 that
> WireGuard requires? In that case you'll be running with a custom
> kernel. Why can't you just update your gcc from the same external
> repo, at the same time?
>
> I just backported to EL7.3 and felt nauseous the whole time. Not sure
> I have the stomach for EL6...

the elrepo kernel for centos 6 is mainline or LT

the kernel is compiled with gcc 4.4.7 and won't run modules compiled 
with newer gcc, the patch is only for older gcc support, not for kernel, 
I don't think that  anyone will complain updating to kernel 4.4+ on el6

the old approach was to compile the module with gcc 4.4.7 commenting the 
two lines in socket.c and after that to build the wg tools with gcc 4.8 
but with this patch the compile is straightforward

regards

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-27 21:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-19 17:44 fix centos 6 compile Lucian Cristian
2017-06-26 12:43 ` Lucian Cristian
2017-06-27 20:59   ` Jason A. Donenfeld
2017-06-27 21:24     ` Lucian Cristian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).