From c1f62b56bd1fc0ed7d08b4ffed5de46844efd1c7 Mon Sep 17 00:00:00 2001 From: Stefan Schwarz Date: Thu, 3 May 2018 10:19:16 +0200 Subject: [PATCH] wrap fixes for 4.10 in indef --- src/compat_xtables.h | 4 +++- src/ts3init_match.c | 4 ++++ src/ts3init_target.c | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/compat_xtables.h b/src/compat_xtables.h index bfba112..0e86727 100644 --- a/src/compat_xtables.h +++ b/src/compat_xtables.h @@ -89,8 +89,10 @@ static inline void proc_remove(struct proc_dir_entry *de) static inline struct net *par_net(const struct xt_action_param *par) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) return xt_net(par); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) + return par->net; #else return dev_net((par->in != NULL) ? par->in : par->out); #endif diff --git a/src/ts3init_match.c b/src/ts3init_match.c index 87d35cc..1428f5e 100644 --- a/src/ts3init_match.c +++ b/src/ts3init_match.c @@ -141,7 +141,11 @@ static inline __u8* get_payload(const struct sk_buff *skb, const struct xt_actio static int calculate_cookie(const struct sk_buff *skb, const struct xt_action_param *par, struct udphdr *udp, __u64 k0, __u64 k1, __u64* out) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) switch (xt_family(par)) +#else + switch (par->family) +#endif { case NFPROTO_IPV4: { diff --git a/src/ts3init_target.c b/src/ts3init_target.c index b66b861..7f48371 100644 --- a/src/ts3init_target.c +++ b/src/ts3init_target.c @@ -47,7 +47,12 @@ ts3init_send_ipv6_reply(struct sk_buff *oldskb, const struct xt_action_param *pa struct udphdr *udp; struct flowi6 fl; struct dst_entry *dst = NULL; + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) struct net *net = dev_net((xt_in(par) != NULL) ? xt_in(par) : xt_out(par)); +#else + struct net *net = dev_net((par->in != NULL) ? par->in : par->out); +#endif skb = alloc_skb(LL_MAX_HEADER + sizeof(*ip) + sizeof(*udp) + payload_size, GFP_ATOMIC);