From: Jan Engelhardt Date: Thu, 13 Jun 2024 08:20:03 +0000 (+0200) Subject: extensions: enable various code paths X-Git-Tag: v3.27~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e8785f6f9bd9427da7e6836b220dd462c42affb;p=thirdparty%2Fxtables-addons.git extensions: enable various code paths ifdef CONFIG_X does not imply CONFIG_X_MODULE. --- diff --git a/extensions/compat_skbuff.h b/extensions/compat_skbuff.h index 5ab6eae..e93256e 100644 --- a/extensions/compat_skbuff.h +++ b/extensions/compat_skbuff.h @@ -1,11 +1,12 @@ #pragma once +#include struct tcphdr; struct udphdr; #define skb_ifindex(skb) (skb)->skb_iif #define skb_nfmark(skb) (((struct sk_buff *)(skb))->mark) -#ifdef CONFIG_NETWORK_SECMARK +#if IS_ENABLED(CONFIG_NETWORK_SECMARK) # define skb_secmark(skb) ((skb)->secmark) #else # define skb_secmark(skb) 0 diff --git a/extensions/compat_xtables.c b/extensions/compat_xtables.c index 0b8293d..53f9012 100644 --- a/extensions/compat_xtables.c +++ b/extensions/compat_xtables.c @@ -7,6 +7,7 @@ * version 2 of the License, or any later version. */ #include +#include #include #include #include @@ -23,7 +24,7 @@ #include #include #include "compat_skbuff.h" -#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) +#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) # define WITH_IPV6 1 #endif diff --git a/extensions/compat_xtables.h b/extensions/compat_xtables.h index 848d3bf..227a962 100644 --- a/extensions/compat_xtables.h +++ b/extensions/compat_xtables.h @@ -1,4 +1,5 @@ #pragma once +#include #include #include #include "compat_skbuff.h" @@ -9,7 +10,7 @@ # warning Kernels below 4.16 not supported. #endif -#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) +#if IS_ENABLED(CONFIG_NF_CONNTRACK) # if !defined(CONFIG_NF_CONNTRACK_MARK) # warning You have CONFIG_NF_CONNTRACK enabled, but CONFIG_NF_CONNTRACK_MARK is not (please enable). # endif diff --git a/extensions/xt_DELUDE.c b/extensions/xt_DELUDE.c index 77bbfdd..ba913cf 100644 --- a/extensions/xt_DELUDE.c +++ b/extensions/xt_DELUDE.c @@ -12,13 +12,14 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ +#include #include #include #include #include #include #include -#ifdef CONFIG_BRIDGE_NETFILTER +#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) # include #endif #include @@ -107,7 +108,7 @@ static void delude_send_reset(struct sk_buff *oldskb, sizeof(struct tcphdr), 0)); addr_type = RTN_UNSPEC; -#ifdef CONFIG_BRIDGE_NETFILTER +#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) if (par->state->hook != NF_INET_FORWARD || ((struct nf_bridge_info *)skb_ext_find(nskb, SKB_EXT_BRIDGE_NF) != NULL && diff --git a/extensions/xt_DNETMAP.c b/extensions/xt_DNETMAP.c index 0b6731e..04d5188 100644 --- a/extensions/xt_DNETMAP.c +++ b/extensions/xt_DNETMAP.c @@ -19,8 +19,9 @@ */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include -#ifdef CONFIG_NF_NAT +#if IS_ENABLED(CONFIG_NF_NAT) #include #include #include diff --git a/extensions/xt_ECHO.c b/extensions/xt_ECHO.c index cdd9238..e72974d 100644 --- a/extensions/xt_ECHO.c +++ b/extensions/xt_ECHO.c @@ -8,13 +8,13 @@ * version 2 of the License, or any later version, as published by the * Free Software Foundation. */ - #include +#include #include #include #include #include -#ifdef CONFIG_BRIDGE_NETFILTER +#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) # include #endif #include @@ -22,7 +22,7 @@ #include #include #include "compat_xtables.h" -#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) +#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) # define WITH_IPV6 1 #endif diff --git a/extensions/xt_SYSRQ.c b/extensions/xt_SYSRQ.c index 998a5b9..d4858c5 100644 --- a/extensions/xt_SYSRQ.c +++ b/extensions/xt_SYSRQ.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -25,11 +26,10 @@ #include #include #include "compat_xtables.h" - -#if defined(CONFIG_CRYPTO) || defined(CONFIG_CRYPTO_MODULE) +#if IS_ENABLED(CONFIG_CRYPTO) # define WITH_CRYPTO 1 #endif -#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) +#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) # define WITH_IPV6 1 #endif @@ -309,7 +309,7 @@ static void sysrq_crypto_exit(void) static int __init sysrq_crypto_init(void) { -#if defined(WITH_CRYPTO) +#ifdef WITH_CRYPTO struct timespec64 now; int ret; diff --git a/extensions/xt_TARPIT.c b/extensions/xt_TARPIT.c index c3875bc..78dfb95 100644 --- a/extensions/xt_TARPIT.c +++ b/extensions/xt_TARPIT.c @@ -37,14 +37,14 @@ * - Reply to TCP SYN,ACK,!RST,!FIN with RST to prevent spoofing * - Reply to TCP !SYN,!RST,!FIN with ACK, window 0 bytes, rate-limited */ - #include +#include #include #include #include #include #include -#ifdef CONFIG_BRIDGE_NETFILTER +#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) # include #endif #include @@ -55,7 +55,7 @@ #include #include "compat_xtables.h" #include "xt_TARPIT.h" -#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) +#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) # define WITH_IPV6 1 #endif @@ -253,7 +253,7 @@ static void tarpit_tcp4(const struct xt_action_param *par, else if (mode == XTTARPIT_HONEYPOT) niph->id = ~oldhdr->id + 1; -#ifdef CONFIG_BRIDGE_NETFILTER +#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) if (par->state->hook != NF_INET_FORWARD || ((struct nf_bridge_info *)skb_ext_find(nskb, SKB_EXT_BRIDGE_NF) != NULL && diff --git a/extensions/xt_length2.c b/extensions/xt_length2.c index 3e8a38e..c5ae28e 100644 --- a/extensions/xt_length2.c +++ b/extensions/xt_length2.c @@ -8,6 +8,7 @@ * Free Software Foundation. */ #include +#include #include #include #include @@ -22,7 +23,7 @@ #include #include "xt_length2.h" #include "compat_xtables.h" -#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) +#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) # define WITH_IPV6 1 #endif #ifndef NEXTHDR_IPV4 diff --git a/extensions/xt_psd.c b/extensions/xt_psd.c index b6c717f..ab08878 100644 --- a/extensions/xt_psd.c +++ b/extensions/xt_psd.c @@ -52,8 +52,7 @@ MODULE_ALIAS("ip6t_psd"); #define HASH_LOG 9 #define PSD_HASH_SIZE (1 << HASH_LOG) #define HASH_MAX 0x10 - -#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) +#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) # define WITH_IPV6 1 #endif