diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-06-20 10:21:00 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-06-24 11:19:18 +0200 |
commit | 07b71d592d4c172f3311e91a36b65e98cae68198 (patch) | |
tree | 7be21a6d878b71d1a7d9114499b05d0336d1b384 /src/compat/udp_tunnel | |
parent | 9ec886debd4766d87d640f00f150fea5b1844e8d (diff) |
compat: unify custom function prefix/suffix
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/compat/udp_tunnel')
-rw-r--r-- | src/compat/udp_tunnel/udp_tunnel.c | 14 | ||||
-rw-r--r-- | src/compat/udp_tunnel/udp_tunnel_partial_compat.h | 20 |
2 files changed, 17 insertions, 17 deletions
diff --git a/src/compat/udp_tunnel/udp_tunnel.c b/src/compat/udp_tunnel/udp_tunnel.c index dc47d61..ae43566 100644 --- a/src/compat/udp_tunnel/udp_tunnel.c +++ b/src/compat/udp_tunnel/udp_tunnel.c @@ -17,7 +17,7 @@ /* This is global so, uh, only one real call site... This is the kind of horrific hack you'd expect to see in compat code. */ static udp_tunnel_encap_rcv_t encap_rcv = NULL; -static void our_sk_data_ready(struct sock *sk +static void __compat_sk_data_ready(struct sock *sk #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) ,int unused_vulnerable_length_param #endif @@ -86,7 +86,7 @@ void setup_udp_tunnel_sock(struct net *net, struct socket *sock, rcu_assign_sk_user_data(sock->sk, cfg->sk_user_data); /* 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; + *(void **)&sock->sk->sk_data_ready = (void *)__compat_sk_data_ready; } #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0) @@ -131,12 +131,12 @@ static void udp_set_csum(bool nocheck, struct sk_buff *skb, #endif -static void fake_destructor(struct sk_buff *skb) +static void __compat_fake_destructor(struct sk_buff *skb) { } #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) -static void our_iptunnel_xmit(struct rtable *rt, struct sk_buff *skb, +static void __compat_iptunnel_xmit(struct rtable *rt, struct sk_buff *skb, __be32 src, __be32 dst, __u8 proto, __u8 tos, __u8 ttl, __be16 df, bool xnet) { @@ -174,7 +174,7 @@ static void our_iptunnel_xmit(struct rtable *rt, struct sk_buff *skb, tstats->tx_bytes -= 8; u64_stats_update_end(&tstats->syncp); } -#define iptunnel_xmit our_iptunnel_xmit +#define iptunnel_xmit __compat_iptunnel_xmit #endif void udp_tunnel_xmit_skb(struct rtable *rt, struct sock *sk, struct sk_buff *skb, @@ -203,7 +203,7 @@ void udp_tunnel_xmit_skb(struct rtable *rt, struct sock *sk, struct sk_buff *skb if (!skb->sk) skb->sk = sk; if (!skb->destructor) - skb->destructor = fake_destructor; + skb->destructor = __compat_fake_destructor; #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) ret = #endif @@ -379,7 +379,7 @@ int udp_tunnel6_xmit_skb(struct dst_entry *dst, struct sock *sk, if (!skb->sk) skb->sk = sk; if (!skb->destructor) - skb->destructor = fake_destructor; + skb->destructor = __compat_fake_destructor; ip6tunnel_xmit(skb, dev); return 0; diff --git a/src/compat/udp_tunnel/udp_tunnel_partial_compat.h b/src/compat/udp_tunnel/udp_tunnel_partial_compat.h index a4b5a14..0605896 100644 --- a/src/compat/udp_tunnel/udp_tunnel_partial_compat.h +++ b/src/compat/udp_tunnel/udp_tunnel_partial_compat.h @@ -19,7 +19,7 @@ #include <net/ip6_checksum.h> #include <net/ip6_tunnel.h> #endif -static inline void fake_destructor(struct sk_buff *skb) +static inline void __compat_fake_destructor(struct sk_buff *skb) { } typedef int (*udp_tunnel_encap_rcv_t)(struct sock *sk, struct sk_buff *skb); @@ -30,7 +30,7 @@ struct udp_tunnel_sock_cfg { }; /* This is global so, uh, only one real call site... This is the kind of horrific hack you'd expect to see in compat code. */ static udp_tunnel_encap_rcv_t encap_rcv = NULL; -static void our_sk_data_ready(struct sock *sk) +static void __compat_sk_data_ready(struct sock *sk) { struct sk_buff *skb; while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { @@ -46,7 +46,7 @@ static inline void setup_udp_tunnel_sock(struct net *net, struct socket *sock, inet_sk(sk)->mc_loop = 0; encap_rcv = cfg->encap_rcv; rcu_assign_sk_user_data(sk, cfg->sk_user_data); - sk->sk_data_ready = our_sk_data_ready; + sk->sk_data_ready = __compat_sk_data_ready; } static inline void udp_tunnel_sock_release(struct socket *sock) { @@ -122,13 +122,13 @@ static inline int udp_tunnel6_xmit_skb(struct socket *sock, struct dst_entry *ds #include <linux/if.h> #include <net/udp_tunnel.h> #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) -static inline void fake_destructor(struct sk_buff *skb) +static inline void __compat_fake_destructor(struct sk_buff *skb) { } #endif -#define udp_tunnel_xmit_skb(a, b, c, d, e, f, g, h, i, j, k, l) do { struct net_device *dev__ = (c)->dev; int ret__; if (!(c)->destructor) (c)->destructor = fake_destructor; if (!(c)->sk) (c)->sk = (b); ret__ = udp_tunnel_xmit_skb(a, c, d, e, f, g, h, i, j, k, l); if (ret__) iptunnel_xmit_stats(ret__ - 8, &dev__->stats, dev__->tstats); } while (0) +#define udp_tunnel_xmit_skb(a, b, c, d, e, f, g, h, i, j, k, l) do { struct net_device *dev__ = (c)->dev; int ret__; if (!(c)->destructor) (c)->destructor = __compat_fake_destructor; if (!(c)->sk) (c)->sk = (b); ret__ = udp_tunnel_xmit_skb(a, c, d, e, f, g, h, i, j, k, l); if (ret__) iptunnel_xmit_stats(ret__ - 8, &dev__->stats, dev__->tstats); } while (0) #if IS_ENABLED(CONFIG_IPV6) -#define udp_tunnel6_xmit_skb(a, b, c, d, e, f, g, h, i, j, k, l) do { if (!(c)->destructor) (c)->destructor = fake_destructor; if (!(c)->sk) (c)->sk = (b); udp_tunnel6_xmit_skb(a, c, d, e, f, g, h, j, k, l); } while(0) +#define udp_tunnel6_xmit_skb(a, b, c, d, e, f, g, h, i, j, k, l) do { if (!(c)->destructor) (c)->destructor = __compat_fake_destructor; if (!(c)->sk) (c)->sk = (b); udp_tunnel6_xmit_skb(a, c, d, e, f, g, h, j, k, l); } while(0) #endif #else @@ -156,7 +156,7 @@ static inline void fake_destructor(struct sk_buff *skb) #include <linux/skbuff.h> #include <linux/if.h> #include <net/udp_tunnel.h> -struct udp_port_cfg_new { +struct __compat_udp_port_cfg { u8 family; union { struct in_addr local_ip; @@ -174,7 +174,7 @@ struct udp_port_cfg_new { __be16 peer_udp_port; unsigned int use_udp_checksums:1, use_udp6_tx_checksums:1, use_udp6_rx_checksums:1, ipv6_v6only:1; }; -static inline int __maybe_unused udp_sock_create_new(struct net *net, struct udp_port_cfg_new *cfg, struct socket **sockp) +static inline int __maybe_unused __compat_udp_sock_create(struct net *net, struct __compat_udp_port_cfg *cfg, struct socket **sockp) { struct udp_port_cfg old_cfg = { .family = cfg->family, @@ -221,6 +221,6 @@ static inline int __maybe_unused udp_sock_create_new(struct net *net, struct udp #endif return -EPFNOSUPPORT; } -#define udp_port_cfg udp_port_cfg_new -#define udp_sock_create(a, b, c) udp_sock_create_new(a, b, c) +#define udp_port_cfg __compat_udp_port_cfg +#define udp_sock_create(a, b, c) __compat_udp_sock_create(a, b, c) #endif |