]> git.ipfire.org Git - thirdparty/xtables-addons.git/commitdiff
extensions: enable various code paths
authorJan Engelhardt <jengelh@inai.de>
Thu, 13 Jun 2024 08:20:03 +0000 (10:20 +0200)
committerJan Engelhardt <jengelh@inai.de>
Thu, 13 Jun 2024 08:20:03 +0000 (10:20 +0200)
ifdef CONFIG_X does not imply CONFIG_X_MODULE.

extensions/compat_skbuff.h
extensions/compat_xtables.c
extensions/compat_xtables.h
extensions/xt_DELUDE.c
extensions/xt_DNETMAP.c
extensions/xt_ECHO.c
extensions/xt_SYSRQ.c
extensions/xt_TARPIT.c
extensions/xt_length2.c
extensions/xt_psd.c

index 5ab6eae99bc6c1735ad775cb6d72c4f064e75135..e93256e76c79806ea400ea989e30b1da64ebf024 100644 (file)
@@ -1,11 +1,12 @@
 #pragma once
+#include <linux/kconfig.h>
 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
index 0b8293da56aee02e57c611eb78fcd41adcfabc94..53f901260a4272f839aceefd4bbacb3a7d81d6d9 100644 (file)
@@ -7,6 +7,7 @@
  *     version 2 of the License, or any later version.
  */
 #include <linux/ip.h>
+#include <linux/kconfig.h>
 #include <linux/kernel.h>
 #include <linux/kmod.h>
 #include <linux/list.h>
@@ -23,7 +24,7 @@
 #include <net/route.h>
 #include <linux/export.h>
 #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
 
index 848d3bff50d8706d732cc59f787f13cd140ffe57..227a962845486c2c61c22d697624b0af1da08cca 100644 (file)
@@ -1,4 +1,5 @@
 #pragma once
+#include <linux/kconfig.h>
 #include <linux/kernel.h>
 #include <linux/version.h>
 #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
index 77bbfdd45fbddd4df0ca45fcde48884ceea9daf1..ba913cf739e4fbe64064fd28b648d6316afeb773 100644 (file)
  *     it under the terms of the GNU General Public License version 2 as
  *     published by the Free Software Foundation.
  */
+#include <linux/kconfig.h>
 #include <linux/module.h>
 #include <linux/skbuff.h>
 #include <linux/ip.h>
 #include <linux/tcp.h>
 #include <linux/version.h>
 #include <linux/netfilter/x_tables.h>
-#ifdef CONFIG_BRIDGE_NETFILTER
+#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
 #      include <linux/netfilter_bridge.h>
 #endif
 #include <net/tcp.h>
@@ -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 &&
index 0b6731e482fdca3a30e2dafd9343444997d04a6a..04d5188a0744506ffbab80f41e6005ca652e31ba 100644 (file)
@@ -19,8 +19,9 @@
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/kconfig.h>
 #include <linux/module.h>
-#ifdef CONFIG_NF_NAT
+#if IS_ENABLED(CONFIG_NF_NAT)
 #include <linux/inet.h>
 #include <linux/ip.h>
 #include <linux/netdevice.h>
index cdd9238d1bebad7a720eed93b543c4f595747f79..e72974d43e2dbabc26c89cff81b2be0bc555113f 100644 (file)
@@ -8,13 +8,13 @@
  *     version 2 of the License, or any later version, as published by the
  *     Free Software Foundation.
  */
-
 #include <linux/ip.h>
+#include <linux/kconfig.h>
 #include <linux/module.h>
 #include <linux/skbuff.h>
 #include <linux/udp.h>
 #include <linux/netfilter/x_tables.h>
-#ifdef CONFIG_BRIDGE_NETFILTER
+#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
 #      include <linux/netfilter_bridge.h>
 #endif
 #include <net/ip.h>
@@ -22,7 +22,7 @@
 #include <net/ip6_route.h>
 #include <net/route.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
 
index 998a5b92be36e0158e67adb17292e0d84e2aac62..d4858c5395e5de987ccc39fe40340e186f46df11 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/in.h>
 #include <linux/ip.h>
 #include <linux/ipv6.h>
+#include <linux/kconfig.h>
 #include <linux/module.h>
 #include <linux/skbuff.h>
 #include <linux/sysrq.h>
 #include <net/ip.h>
 #include <net/ipv6.h>
 #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;
 
index c3875bc0f47f24e6e82745badc0b10eb0b3e677f..78dfb95160c4d994581c188587a2f1f933064006 100644 (file)
  * - 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 <linux/ip.h>
+#include <linux/kconfig.h>
 #include <linux/module.h>
 #include <linux/skbuff.h>
 #include <linux/version.h>
 #include <linux/netfilter_ipv6.h>
 #include <linux/netfilter/x_tables.h>
-#ifdef CONFIG_BRIDGE_NETFILTER
+#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER)
 #      include <linux/netfilter_bridge.h>
 #endif
 #include <net/addrconf.h>
@@ -55,7 +55,7 @@
 #include <net/tcp.h>
 #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 &&
index 3e8a38ea6f0e9dade200ccef494ff870f176d7c9..c5ae28ee87511b1e243b4a6f00344143055344c0 100644 (file)
@@ -8,6 +8,7 @@
  *     Free Software Foundation.
  */
 #include <linux/dccp.h>
+#include <linux/kconfig.h>
 #include <linux/module.h>
 #include <linux/skbuff.h>
 #include <linux/icmp.h>
@@ -22,7 +23,7 @@
 #include <linux/netfilter_ipv6/ip6_tables.h>
 #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
index b6c717f14c3ddd95edf1e79dea9c708794785b16..ab08878861d97141d95570b82eba04d28f81cd3f 100644 (file)
@@ -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