From: Alexander Petrenas Date: Tue, 23 Jun 2015 10:44:50 +0000 (+0300) Subject: xt_TARPIT: support for Linux 4.1 X-Git-Tag: v2.7~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96ce5ec48828d88da703ba00ef734d0c73ca6bc9;p=thirdparty%2Fxtables-addons.git xt_TARPIT: support for Linux 4.1 --- diff --git a/configure.ac b/configure.ac index de3fec4..f16bb16 100644 --- a/configure.ac +++ b/configure.ac @@ -63,8 +63,10 @@ if test -n "$kbuilddir"; then echo "WARNING: Version detection did not succeed. Continue at own luck."; else echo "$kmajor.$kminor.$kmicro.$kstable in $kbuilddir"; - if test "$kmajor" -gt 3 -o "$kmajor" -eq 3 -a "$kminor" -gt 17; then + if test "$kmajor" -gt 4 -o "$kmajor" -eq 4 -a "$kminor" -gt 1; then echo "WARNING: That kernel version is not officially supported yet. Continue at own luck."; + elif test "$kmajor" -eq 4 -a "$kminor" -le 1; then + :; elif test "$kmajor" -eq 3 -a "$kminor" -ge 7; then :; else diff --git a/doc/changelog.txt b/doc/changelog.txt index db394eb..b6feed4 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -1,6 +1,8 @@ HEAD ==== +Enhancements: +- Support for Linux up to 4.1 v2.6 (2014-09-29) diff --git a/extensions/xt_DELUDE.c b/extensions/xt_DELUDE.c index 39d92e3..1568252 100644 --- a/extensions/xt_DELUDE.c +++ b/extensions/xt_DELUDE.c @@ -106,8 +106,13 @@ static void delude_send_reset(struct sk_buff *oldskb, unsigned int hook) addr_type = RTN_UNSPEC; #ifdef CONFIG_BRIDGE_NETFILTER +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0) + if (hook != NF_INET_FORWARD || (nskb->nf_bridge != NULL && + nskb->nf_bridge->physoutdev)) +#else if (hook != NF_INET_FORWARD || (nskb->nf_bridge != NULL && nskb->nf_bridge->mask & BRNF_BRIDGED)) +#endif #else if (hook != NF_INET_FORWARD) #endif diff --git a/extensions/xt_TARPIT.c b/extensions/xt_TARPIT.c index dbfb834..67986ad 100644 --- a/extensions/xt_TARPIT.c +++ b/extensions/xt_TARPIT.c @@ -249,8 +249,13 @@ static void tarpit_tcp4(struct sk_buff *oldskb, unsigned int hook, niph->id = ~oldhdr->id + 1; #ifdef CONFIG_BRIDGE_NETFILTER +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0) + if (hook != NF_INET_FORWARD || (nskb->nf_bridge != NULL && + nskb->nf_bridge->physoutdev != NULL)) +#else if (hook != NF_INET_FORWARD || (nskb->nf_bridge != NULL && nskb->nf_bridge->mask & BRNF_BRIDGED)) +#endif #else if (hook != NF_INET_FORWARD) #endif @@ -279,8 +284,13 @@ static void tarpit_tcp4(struct sk_buff *oldskb, unsigned int hook, 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, + skb_dst(nskb)->dev, dst_output_sk); +#else NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_OUT, nskb, NULL, skb_dst(nskb)->dev, dst_output); +#endif return; free_nskb: @@ -394,8 +404,13 @@ static void tarpit_tcp6(struct sk_buff *oldskb, unsigned int hook, 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, + skb_dst(nskb)->dev, dst_output_sk); +#else NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, nskb, NULL, skb_dst(nskb)->dev, dst_output); +#endif return; free_nskb: