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 #include #include +#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)\""