# old sockopt interface and eval loop
 config BRIDGE_NF_EBTABLES_LEGACY
        tristate "Legacy EBTABLES support"
-       depends on BRIDGE && NETFILTER_XTABLES
-       default n
+       depends on BRIDGE && NETFILTER_XTABLES_LEGACY
+       default n
        help
         Legacy ebtables packet/frame classifier.
         This is not needed if you are using ebtables over nftables
 #
 config BRIDGE_EBT_BROUTE
        tristate "ebt: broute table support"
-       select BRIDGE_NF_EBTABLES_LEGACY
+       depends on BRIDGE_NF_EBTABLES_LEGACY
        help
          The ebtables broute table is used to define rules that decide between
          bridging and routing frames, giving Linux the functionality of a
 
 config BRIDGE_EBT_T_FILTER
        tristate "ebt: filter table support"
-       select BRIDGE_NF_EBTABLES_LEGACY
+       depends on BRIDGE_NF_EBTABLES_LEGACY
        help
          The ebtables filter table is used to define frame filtering rules at
          local input, forwarding and local output. See the man page for
 
 config BRIDGE_EBT_T_NAT
        tristate "ebt: nat table support"
-       select BRIDGE_NF_EBTABLES_LEGACY
+       depends on BRIDGE_NF_EBTABLES_LEGACY
        help
          The ebtables nat table is used to define rules that alter the MAC
          source address (MAC SNAT) or the MAC destination address (MAC DNAT).
 
 # old sockopt interface and eval loop
 config IP_NF_IPTABLES_LEGACY
        tristate "Legacy IP tables support"
-       default n
-       select NETFILTER_XTABLES
+       depends on NETFILTER_XTABLES_LEGACY
+       default m if NETFILTER_XTABLES_LEGACY
        help
          iptables is a legacy packet classifier.
          This is not needed if you are using iptables over nftables
 # `filter', generic and specific targets
 config IP_NF_FILTER
        tristate "Packet filtering"
-       default m if NETFILTER_ADVANCED=n
-       select IP_NF_IPTABLES_LEGACY
+       default m if NETFILTER_ADVANCED=n || IP_NF_IPTABLES_LEGACY
+       depends on IP_NF_IPTABLES_LEGACY
        help
          Packet filtering defines a table `filter', which has a series of
          rules for simple packet filtering at local input, forwarding and
 config IP_NF_NAT
        tristate "iptables NAT support"
        depends on NF_CONNTRACK
+       depends on IP_NF_IPTABLES_LEGACY
        default m if NETFILTER_ADVANCED=n
        select NF_NAT
        select NETFILTER_XT_NAT
-       select IP_NF_IPTABLES_LEGACY
        help
          This enables the `nat' table in iptables. This allows masquerading,
          port forwarding and other forms of full Network Address Port
 # mangle + specific targets
 config IP_NF_MANGLE
        tristate "Packet mangling"
-       default m if NETFILTER_ADVANCED=n
-       select IP_NF_IPTABLES_LEGACY
+       default m if NETFILTER_ADVANCED=n || IP_NF_IPTABLES_LEGACY
+       depends on IP_NF_IPTABLES_LEGACY
        help
          This option adds a `mangle' table to iptables: see the man page for
          iptables(8).  This table is used for various packet alterations
 # raw + specific targets
 config IP_NF_RAW
        tristate  'raw table support (required for NOTRACK/TRACE)'
-       select IP_NF_IPTABLES_LEGACY
+       depends on IP_NF_IPTABLES_LEGACY
        help
          This option adds a `raw' table to iptables. This table is the very
          first in the netfilter framework and hooks in at the PREROUTING
        tristate "Security table"
        depends on SECURITY
        depends on NETFILTER_ADVANCED
-       select IP_NF_IPTABLES_LEGACY
+       depends on IP_NF_IPTABLES_LEGACY
        help
          This option adds a `security' table to iptables, for use
          with Mandatory Access Control (MAC) policy.
 # ARP tables
 config IP_NF_ARPTABLES
        tristate "Legacy ARPTABLES support"
-       depends on NETFILTER_XTABLES
-       default n
+       depends on NETFILTER_XTABLES_LEGACY
+       default n
        help
          arptables is a legacy packet classifier.
          This is not needed if you are using arptables over nftables
        tristate "arptables-legacy packet filtering support"
        select IP_NF_ARPTABLES
        select NETFILTER_FAMILY_ARP
-       depends on NETFILTER_XTABLES
+       depends on NETFILTER_XTABLES_LEGACY
        help
          ARP packet filtering defines a table `filter', which has a series of
          rules for simple ARP packet filtering at local input and
 
 # old sockopt interface and eval loop
 config IP6_NF_IPTABLES_LEGACY
        tristate "Legacy IP6 tables support"
-       depends on INET && IPV6
-       select NETFILTER_XTABLES
-       default n
+       depends on INET && IPV6 && NETFILTER_XTABLES_LEGACY
+       default m if NETFILTER_XTABLES_LEGACY
        help
          ip6tables is a legacy packet classifier.
          This is not needed if you are using iptables over nftables
 
 config IP6_NF_FILTER
        tristate "Packet filtering"
-       default m if NETFILTER_ADVANCED=n
-       select IP6_NF_IPTABLES_LEGACY
+       default m if NETFILTER_ADVANCED=n || IP6_NF_IPTABLES_LEGACY
+       depends on IP6_NF_IPTABLES_LEGACY
        tristate
        help
          Packet filtering defines a table `filter', which has a series of
 
 config IP6_NF_MANGLE
        tristate "Packet mangling"
-       default m if NETFILTER_ADVANCED=n
-       select IP6_NF_IPTABLES_LEGACY
+       default m if NETFILTER_ADVANCED=n || IP6_NF_IPTABLES_LEGACY
+       depends on IP6_NF_IPTABLES_LEGACY
        help
          This option adds a `mangle' table to iptables: see the man page for
          iptables(8).  This table is used for various packet alterations
 
 config IP6_NF_RAW
        tristate  'raw table support (required for TRACE)'
-       select IP6_NF_IPTABLES_LEGACY
+       depends on IP6_NF_IPTABLES_LEGACY
        help
          This option adds a `raw' table to ip6tables. This table is the very
          first in the netfilter framework and hooks in at the PREROUTING
        tristate "Security table"
        depends on SECURITY
        depends on NETFILTER_ADVANCED
-       select IP6_NF_IPTABLES_LEGACY
+       depends on IP6_NF_IPTABLES_LEGACY
        help
          This option adds a `security' table to iptables, for use
          with Mandatory Access Control (MAC) policy.
        tristate "ip6tables NAT support"
        depends on NF_CONNTRACK
        depends on NETFILTER_ADVANCED
+       depends on IP6_NF_IPTABLES_LEGACY
        select NF_NAT
-       select IP6_NF_IPTABLES_LEGACY
        select NETFILTER_XT_NAT
        help
          This enables the `nat' table in ip6tables. This allows masquerading,
 
 
           If unsure, say N.
 
+config NETFILTER_XTABLES_LEGACY
+       bool "Netfilter legacy tables support"
+       depends on !PREEMPT_RT
+       help
+         Say Y here if you still require support for legacy tables. This is
+         required by the legacy tools (iptables-legacy) and is not needed if
+         you use iptables over nftables (iptables-nft).
+         Legacy support is not limited to IP, it also includes EBTABLES and
+         ARPTABLES.
+
 comment "Xtables combined modules"
 
 config NETFILTER_XT_MARK
 
 EXPORT_SYMBOL_GPL(xt_compat_unlock);
 #endif
 
-DEFINE_PER_CPU(seqcount_t, xt_recseq);
-EXPORT_PER_CPU_SYMBOL_GPL(xt_recseq);
-
 struct static_key xt_tee_enabled __read_mostly;
 EXPORT_SYMBOL_GPL(xt_tee_enabled);
 
+#ifdef CONFIG_NETFILTER_XTABLES_LEGACY
+DEFINE_PER_CPU(seqcount_t, xt_recseq);
+EXPORT_PER_CPU_SYMBOL_GPL(xt_recseq);
+
 static int xt_jumpstack_alloc(struct xt_table_info *i)
 {
        unsigned int size;
        return private;
 }
 EXPORT_SYMBOL_GPL(xt_unregister_table);
+#endif
 
 #ifdef CONFIG_PROC_FS
 static void *xt_table_seq_start(struct seq_file *seq, loff_t *pos)
 }
 EXPORT_SYMBOL_GPL(xt_proto_fini);
 
+#ifdef CONFIG_NETFILTER_XTABLES_LEGACY
 /**
  * xt_percpu_counter_alloc - allocate x_tables rule counter
  *
                free_percpu((void __percpu *)pcnt);
 }
 EXPORT_SYMBOL_GPL(xt_percpu_counter_free);
+#endif
 
 static int __net_init xt_net_init(struct net *net)
 {
        unsigned int i;
        int rv;
 
-       for_each_possible_cpu(i) {
-               seqcount_init(&per_cpu(xt_recseq, i));
+       if (IS_ENABLED(CONFIG_NETFILTER_XTABLES_LEGACY)) {
+               for_each_possible_cpu(i) {
+                       seqcount_init(&per_cpu(xt_recseq, i));
+               }
        }
 
        xt = kcalloc(NFPROTO_NUMPROTO, sizeof(struct xt_af), GFP_KERNEL);