diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-12-08 13:46:21 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-12-12 12:23:45 +0100 |
commit | 513c6437283f265d7f60d762585a431eb44892cc (patch) | |
tree | 368863253f34bd24d12054eac362edbca1bab855 | |
parent | 93eab570525e3b3e2ae7cf999ad0f7a4d93f2ab9 (diff) |
socket: convert to ipv6_dst_lookup_flow for 5.5
Upstream changed the API, so we introduce this super insane compat hack
to make everything work again.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | src/compat/compat.h | 4 | ||||
-rw-r--r-- | src/socket.c | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/compat/compat.h b/src/compat/compat.h index ab22fa4..b4a8f8b 100644 --- a/src/compat/compat.h +++ b/src/compat/compat.h @@ -861,6 +861,10 @@ static inline void skb_mark_not_on_list(struct sk_buff *skb) }) #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0) +#define ipv6_dst_lookup_flow(a, b, c, d) ipv6_dst_lookup(a, b, &dst, c) + (void *)0 ?: dst +#endif + #if defined(ISUBUNTU1604) #include <linux/siphash.h> #ifndef _WG_LINUX_SIPHASH_H diff --git a/src/socket.c b/src/socket.c index a90dadd..c46256d 100644 --- a/src/socket.c +++ b/src/socket.c @@ -142,9 +142,10 @@ static int send6(struct wg_device *wg, struct sk_buff *skb, if (cache) dst_cache_reset(cache); } - ret = ipv6_stub->ipv6_dst_lookup(sock_net(sock), sock, &dst, - &fl); - if (unlikely(ret)) { + dst = ipv6_stub->ipv6_dst_lookup_flow(sock_net(sock), sock, &fl, + NULL); + if (unlikely(IS_ERR(dst))) { + ret = PTR_ERR(dst); net_dbg_ratelimited("%s: No route to %pISpfsc, error %d\n", wg->dev->name, &endpoint->addr, ret); goto err; |