#include "compat_xtables.h"
#define PFX KBUILD_MODNAME ": "
-static void delude_send_reset(struct sk_buff *oldskb, unsigned int hook)
+static void delude_send_reset(struct net *net, struct sk_buff *oldskb,
+ unsigned int hook)
{
struct tcphdr _otcph, *tcph;
const struct tcphdr *oth;
/* ip_route_me_harder expects skb->dst to be set */
skb_dst_set(nskb, dst_clone(skb_dst(oldskb)));
- if (ip_route_me_harder(nskb, addr_type))
+ if (ip_route_me_harder(net, nskb, addr_type))
goto free_nskb;
else
niph = ip_hdr(nskb);
nf_ct_attach(nskb, oldskb);
- ip_local_out(nskb);
+ ip_local_out(net, nskb->sk, nskb);
return;
free_nskb:
* a problem, as that is supported since Linux 2.6.35. But since we do not
* actually want to have a connection open, we are still going to drop it.
*/
- delude_send_reset(skb, par->hooknum);
+ delude_send_reset(par_net(par), skb, par->hooknum);
return NF_DROP;
}
return true;
}
-static void tarpit_tcp4(struct sk_buff *oldskb, unsigned int hook,
- unsigned int mode)
+static void tarpit_tcp4(struct net *net, struct sk_buff *oldskb,
+ unsigned int hook, unsigned int mode)
{
struct tcphdr _otcph, *tcph;
const struct tcphdr *oth;
#endif
addr_type = RTN_LOCAL;
- if (ip_route_me_harder(nskb, addr_type))
+ if (ip_route_me_harder(net, nskb, addr_type))
goto free_nskb;
else
niph = ip_hdr(nskb);
nf_ct_attach(nskb, oldskb);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)
- NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_OUT, NULL, nskb, NULL,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)
+ NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_OUT, net, nskb->sk, nskb, NULL,
+ skb_dst(nskb)->dev, dst_output);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)
+ NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_OUT, nskb->sk, nskb, NULL,
skb_dst(nskb)->dev, dst_output_sk);
#else
NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_OUT, nskb, NULL,
}
#ifdef WITH_IPV6
-static void tarpit_tcp6(struct sk_buff *oldskb, unsigned int hook,
- unsigned int mode)
+static void tarpit_tcp6(struct net *net, struct sk_buff *oldskb,
+ unsigned int hook, unsigned int mode)
{
struct sk_buff *nskb;
struct tcphdr *tcph, oth;
IPPROTO_TCP,
csum_partial(tcph, sizeof(struct tcphdr), 0));
- if (ip6_route_me_harder(nskb))
+ if (ip6_route_me_harder(net, nskb))
goto free_nskb;
nskb->ip_summed = CHECKSUM_NONE;
nf_ct_attach(nskb, oldskb);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)
- NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, NULL, nskb, NULL,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)
+ NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, net, nskb->sk, nskb, NULL,
+ skb_dst(nskb)->dev, dst_output);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)
+ NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, nskb->sk, nskb, NULL,
skb_dst(nskb)->dev, dst_output_sk);
#else
NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, nskb, NULL,
if (iph->frag_off & htons(IP_OFFSET))
return NF_DROP;
- tarpit_tcp4(skb, par->hooknum, info->variant);
+ tarpit_tcp4(par_net(par), skb, par->hooknum, info->variant);
return NF_DROP;
}
return NF_DROP;
}
- tarpit_tcp6(skb, par->hooknum, info->variant);
+ tarpit_tcp6(par_net(par), skb, par->hooknum, info->variant);
return NF_DROP;
}
#endif