From d8e4c98cf20c97246dc747b934d9cacd515ee3f0 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 14 Apr 2019 10:57:12 +0200 Subject: compat: udp_tunnel: force cast sk_data_ready Reference: https://lists.zx2c4.com/pipermail/wireguard/2019-April/004081.html --- src/compat/udp_tunnel/udp_tunnel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/compat') diff --git a/src/compat/udp_tunnel/udp_tunnel.c b/src/compat/udp_tunnel/udp_tunnel.c index 6afb11d..dc47d61 100644 --- a/src/compat/udp_tunnel/udp_tunnel.c +++ b/src/compat/udp_tunnel/udp_tunnel.c @@ -84,7 +84,9 @@ void setup_udp_tunnel_sock(struct net *net, struct socket *sock, inet_sk(sock->sk)->mc_loop = 0; encap_rcv = cfg->encap_rcv; rcu_assign_sk_user_data(sock->sk, cfg->sk_user_data); - sock->sk->sk_data_ready = our_sk_data_ready; + /* We force the cast in this awful way, due to various Android kernels + * backporting things stupidly. */ + *(void **)&sock->sk->sk_data_ready = (void *)our_sk_data_ready; } #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0) -- cgit v1.2.3-59-g8ed1b