2021-03-15 13:43:30

by Frank Wunderlich

[permalink] [raw]
Subject: [PATCH] net: wireguard: fix error with icmp{,v6}_ndo_send in 5.4

From: Frank Wunderlich <[email protected]>

commit 2019554f9656 introduces implementation of icmp{,v6}_ndo_send in
include/linux/icmp{,v6}.h in case of NF_NAT is enabled. Now these
functions are defined twice in wireguard. Fix this by hiding code if
NF_NAT is set (reverse condition as in icmp*.h)

././net/wireguard/compat/compat.h:959:20: error: static declaration of 'icmp_ndo_send' follows non-static declaration
959 | static inline void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info)
./include/net/icmp.h:47:6: note: previous declaration of 'icmp_ndo_send' was here
47 | void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info);
././net/wireguard/compat/compat.h:988:20: error: static declaration of 'icmpv6_ndo_send' follows non-static declaration
988 | static inline void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info)
./include/linux/icmpv6.h:56:6: note: previous declaration of 'icmpv6_ndo_send' was here
56 | void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info);

Fixes: 2019554f9656 ("icmp: introduce helper for nat'd source address in network device context")
Signed-off-by: Frank Wunderlich <[email protected]>
---
net/wireguard/compat/compat.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/net/wireguard/compat/compat.h b/net/wireguard/compat/compat.h
index 42f7beecaa5c..7cdb0b253c60 100644
--- a/net/wireguard/compat/compat.h
+++ b/net/wireguard/compat/compat.h
@@ -956,6 +956,7 @@ static inline int skb_ensure_writable(struct sk_buff *skb, int write_len)
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
#include <net/netfilter/nf_nat_core.h>
#endif
+#if !IS_ENABLED(CONFIG_NF_NAT)
static inline void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info)
{
struct sk_buff *cloned_skb = NULL;
@@ -1014,6 +1015,7 @@ static inline void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u
out:
consume_skb(cloned_skb);
}
+#endif
#else
#define icmp_ndo_send icmp_send
#define icmpv6_ndo_send icmpv6_send
--
2.25.1


2021-03-16 17:09:46

by Frank Wunderlich

[permalink] [raw]
Subject: Aw: [PATCH] net: wireguard: fix error with icmp{,v6}_ndo_send in 5.4

Hi,

sorry, please ignore this
wireguard was included with 5.6, my 5.4 uses external wireguard

regards Frank