Skip to content

Commit c6dc26d

Browse files
committed
Merge tag 'nf-next-25-07-25' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next
Pablo Neira Ayuso says: ==================== Netfilter/IPVS updates for net-next The following series contains Netfilter/IPVS updates for net-next: 1) Display netns inode in conntrack table full log, from lvxiafei. 2) Autoload nf_log_syslog in case no logging backend is available, from Lance Yang. 3) Three patches to remove unused functions in x_tables, nf_tables and conntrack. From Yue Haibing. 4) Exclude LEGACY TABLES on PREEMPT_RT: Add NETFILTER_XTABLES_LEGACY to exclude xtables legacy infrastructure. 5) Restore selftests by toggling NETFILTER_XTABLES_LEGACY where needed. From Florian Westphal. 6) Use CONFIG_INET_SCTP_DIAG in tools/testing/selftests/net/netfilter/config, from Sebastian Andrzej Siewior. 7) Use timer_delete in comment in IPVS codebase, from WangYuli. 8) Dump flowtable information in nfnetlink_hook, this includes an initial patch to consolidate common code in helper function, from Phil Sutter. 9) Remove unused arguments in nft_pipapo set backend, from Florian Westphal. 10) Return nft_set_ext instead of boolean in set lookup function, from Florian Westphal. 11) Remove indirection in dynamic set infrastructure, also from Florian. 12) Consolidate pipapo_get/lookup, from Florian. 13) Use kvmalloc in nft_pipapop, from Florian Westphal. 14) syzbot reports slab-out-of-bounds in xt_nfacct log message, fix from Florian Westphal. 15) Ignored tainted kernels in selftest nft_interface_stress.sh, from Phil Sutter. 16) Fix IPVS selftest by disabling rp_filter with ipip tunnel device, from Yi Chen. * tag 'nf-next-25-07-25' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next: selftests: netfilter: ipvs.sh: Explicity disable rp_filter on interface tunl0 selftests: netfilter: Ignore tainted kernels in interface stress test netfilter: xt_nfacct: don't assume acct name is null-terminated netfilter: nft_set_pipapo: prefer kvmalloc for scratch maps netfilter: nft_set_pipapo: merge pipapo_get/lookup netfilter: nft_set: remove indirection from update API call netfilter: nft_set: remove one argument from lookup and update functions netfilter: nft_set_pipapo: remove unused arguments netfilter: nfnetlink_hook: Dump flowtable info netfilter: nfnetlink: New NFNLA_HOOK_INFO_DESC helper ipvs: Rename del_timer in comment in ip_vs_conn_expire_now() selftests: netfilter: Enable CONFIG_INET_SCTP_DIAG selftests: net: Enable legacy netfilter legacy options. netfilter: Exclude LEGACY TABLES on PREEMPT_RT. netfilter: conntrack: Remove unused net in nf_conntrack_double_lock() netfilter: nf_tables: Remove unused nft_reduce_is_readonly() netfilter: x_tables: Remove unused functions xt_{in|out}name() netfilter: load nf_log_syslog on enabling nf_conntrack_log_invalid netfilter: conntrack: table full detailed log ==================== Link: https://patch.msgid.link/20250725170340.21327-1-pablo@netfilter.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents ecc383e + 8b4a1a4 commit c6dc26d

34 files changed

Lines changed: 402 additions & 348 deletions

include/linux/netfilter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ enum nf_hook_ops_type {
9292
NF_HOOK_OP_UNDEFINED,
9393
NF_HOOK_OP_NF_TABLES,
9494
NF_HOOK_OP_BPF,
95+
NF_HOOK_OP_NFT_FT,
9596
};
9697

9798
struct nf_hook_ops {

include/linux/netfilter/x_tables.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,11 @@ static inline struct net_device *xt_in(const struct xt_action_param *par)
5151
return par->state->in;
5252
}
5353

54-
static inline const char *xt_inname(const struct xt_action_param *par)
55-
{
56-
return par->state->in->name;
57-
}
58-
5954
static inline struct net_device *xt_out(const struct xt_action_param *par)
6055
{
6156
return par->state->out;
6257
}
6358

64-
static inline const char *xt_outname(const struct xt_action_param *par)
65-
{
66-
return par->state->out->name;
67-
}
68-
6959
static inline unsigned int xt_hooknum(const struct xt_action_param *par)
7060
{
7161
return par->state->hook;

include/net/netfilter/nf_log.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ extern int sysctl_nf_log_all_netns;
5959
int nf_log_register(u_int8_t pf, struct nf_logger *logger);
6060
void nf_log_unregister(struct nf_logger *logger);
6161

62+
/* Check if any logger is registered for a given protocol family. */
63+
bool nf_log_is_registered(u_int8_t pf);
64+
6265
int nf_log_set(struct net *net, u_int8_t pf, const struct nf_logger *logger);
6366
void nf_log_unset(struct net *net, const struct nf_logger *logger);
6467

include/net/netfilter/nf_tables.h

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -459,19 +459,13 @@ struct nft_set_ext;
459459
* control plane functions.
460460
*/
461461
struct nft_set_ops {
462-
bool (*lookup)(const struct net *net,
462+
const struct nft_set_ext * (*lookup)(const struct net *net,
463463
const struct nft_set *set,
464+
const u32 *key);
465+
const struct nft_set_ext * (*update)(struct nft_set *set,
464466
const u32 *key,
465-
const struct nft_set_ext **ext);
466-
bool (*update)(struct nft_set *set,
467-
const u32 *key,
468-
struct nft_elem_priv *
469-
(*new)(struct nft_set *,
470-
const struct nft_expr *,
471-
struct nft_regs *),
472467
const struct nft_expr *expr,
473-
struct nft_regs *regs,
474-
const struct nft_set_ext **ext);
468+
struct nft_regs *regs);
475469
bool (*delete)(const struct nft_set *set,
476470
const u32 *key);
477471

@@ -1939,11 +1933,6 @@ static inline u64 nft_net_tstamp(const struct net *net)
19391933
#define __NFT_REDUCE_READONLY 1UL
19401934
#define NFT_REDUCE_READONLY (void *)__NFT_REDUCE_READONLY
19411935

1942-
static inline bool nft_reduce_is_readonly(const struct nft_expr *expr)
1943-
{
1944-
return expr->ops->reduce == NFT_REDUCE_READONLY;
1945-
}
1946-
19471936
void nft_reg_track_update(struct nft_regs_track *track,
19481937
const struct nft_expr *expr, u8 dreg, u8 len);
19491938
void nft_reg_track_cancel(struct nft_regs_track *track, u8 dreg, u8 len);

include/net/netfilter/nf_tables_core.h

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -94,34 +94,41 @@ extern const struct nft_set_type nft_set_pipapo_type;
9494
extern const struct nft_set_type nft_set_pipapo_avx2_type;
9595

9696
#ifdef CONFIG_MITIGATION_RETPOLINE
97-
bool nft_rhash_lookup(const struct net *net, const struct nft_set *set,
98-
const u32 *key, const struct nft_set_ext **ext);
99-
bool nft_rbtree_lookup(const struct net *net, const struct nft_set *set,
100-
const u32 *key, const struct nft_set_ext **ext);
101-
bool nft_bitmap_lookup(const struct net *net, const struct nft_set *set,
102-
const u32 *key, const struct nft_set_ext **ext);
103-
bool nft_hash_lookup_fast(const struct net *net,
104-
const struct nft_set *set,
105-
const u32 *key, const struct nft_set_ext **ext);
106-
bool nft_hash_lookup(const struct net *net, const struct nft_set *set,
107-
const u32 *key, const struct nft_set_ext **ext);
108-
bool nft_set_do_lookup(const struct net *net, const struct nft_set *set,
109-
const u32 *key, const struct nft_set_ext **ext);
97+
const struct nft_set_ext *
98+
nft_rhash_lookup(const struct net *net, const struct nft_set *set,
99+
const u32 *key);
100+
const struct nft_set_ext *
101+
nft_rbtree_lookup(const struct net *net, const struct nft_set *set,
102+
const u32 *key);
103+
const struct nft_set_ext *
104+
nft_bitmap_lookup(const struct net *net, const struct nft_set *set,
105+
const u32 *key);
106+
const struct nft_set_ext *
107+
nft_hash_lookup_fast(const struct net *net, const struct nft_set *set,
108+
const u32 *key);
109+
const struct nft_set_ext *
110+
nft_hash_lookup(const struct net *net, const struct nft_set *set,
111+
const u32 *key);
112+
const struct nft_set_ext *
113+
nft_set_do_lookup(const struct net *net, const struct nft_set *set,
114+
const u32 *key);
110115
#else
111-
static inline bool
116+
static inline const struct nft_set_ext *
112117
nft_set_do_lookup(const struct net *net, const struct nft_set *set,
113-
const u32 *key, const struct nft_set_ext **ext)
118+
const u32 *key)
114119
{
115-
return set->ops->lookup(net, set, key, ext);
120+
return set->ops->lookup(net, set, key);
116121
}
117122
#endif
118123

119124
/* called from nft_pipapo_avx2.c */
120-
bool nft_pipapo_lookup(const struct net *net, const struct nft_set *set,
121-
const u32 *key, const struct nft_set_ext **ext);
125+
const struct nft_set_ext *
126+
nft_pipapo_lookup(const struct net *net, const struct nft_set *set,
127+
const u32 *key);
122128
/* called from nft_set_pipapo.c */
123-
bool nft_pipapo_avx2_lookup(const struct net *net, const struct nft_set *set,
124-
const u32 *key, const struct nft_set_ext **ext);
129+
const struct nft_set_ext *
130+
nft_pipapo_avx2_lookup(const struct net *net, const struct nft_set *set,
131+
const u32 *key);
125132

126133
void nft_counter_init_seqcount(void);
127134

@@ -181,4 +188,7 @@ void nft_objref_eval(const struct nft_expr *expr, struct nft_regs *regs,
181188
const struct nft_pktinfo *pkt);
182189
void nft_objref_map_eval(const struct nft_expr *expr, struct nft_regs *regs,
183190
const struct nft_pktinfo *pkt);
191+
struct nft_elem_priv *nft_dynset_new(struct nft_set *set,
192+
const struct nft_expr *expr,
193+
struct nft_regs *regs);
184194
#endif /* _NET_NF_TABLES_CORE_H */

include/uapi/linux/netfilter/nfnetlink_hook.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ enum nfnl_hook_chain_desc_attributes {
6161
*
6262
* @NFNL_HOOK_TYPE_NFTABLES: nf_tables base chain
6363
* @NFNL_HOOK_TYPE_BPF: bpf program
64+
* @NFNL_HOOK_TYPE_NFT_FLOWTABLE: nf_tables flowtable
6465
*/
6566
enum nfnl_hook_chaintype {
6667
NFNL_HOOK_TYPE_NFTABLES = 0x1,
6768
NFNL_HOOK_TYPE_BPF,
69+
NFNL_HOOK_TYPE_NFT_FLOWTABLE,
6870
};
6971

7072
/**

net/bridge/netfilter/Kconfig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ config NF_CONNTRACK_BRIDGE
4242
# old sockopt interface and eval loop
4343
config BRIDGE_NF_EBTABLES_LEGACY
4444
tristate "Legacy EBTABLES support"
45-
depends on BRIDGE && NETFILTER_XTABLES
46-
default n
45+
depends on BRIDGE && NETFILTER_XTABLES_LEGACY
46+
default n
4747
help
4848
Legacy ebtables packet/frame classifier.
4949
This is not needed if you are using ebtables over nftables
@@ -65,7 +65,7 @@ if BRIDGE_NF_EBTABLES
6565
#
6666
config BRIDGE_EBT_BROUTE
6767
tristate "ebt: broute table support"
68-
select BRIDGE_NF_EBTABLES_LEGACY
68+
depends on BRIDGE_NF_EBTABLES_LEGACY
6969
help
7070
The ebtables broute table is used to define rules that decide between
7171
bridging and routing frames, giving Linux the functionality of a
@@ -76,7 +76,7 @@ config BRIDGE_EBT_BROUTE
7676

7777
config BRIDGE_EBT_T_FILTER
7878
tristate "ebt: filter table support"
79-
select BRIDGE_NF_EBTABLES_LEGACY
79+
depends on BRIDGE_NF_EBTABLES_LEGACY
8080
help
8181
The ebtables filter table is used to define frame filtering rules at
8282
local input, forwarding and local output. See the man page for
@@ -86,7 +86,7 @@ config BRIDGE_EBT_T_FILTER
8686

8787
config BRIDGE_EBT_T_NAT
8888
tristate "ebt: nat table support"
89-
select BRIDGE_NF_EBTABLES_LEGACY
89+
depends on BRIDGE_NF_EBTABLES_LEGACY
9090
help
9191
The ebtables nat table is used to define rules that alter the MAC
9292
source address (MAC SNAT) or the MAC destination address (MAC DNAT).

net/ipv4/netfilter/Kconfig

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ config NF_DEFRAG_IPV4
1313
# old sockopt interface and eval loop
1414
config IP_NF_IPTABLES_LEGACY
1515
tristate "Legacy IP tables support"
16-
default n
17-
select NETFILTER_XTABLES
16+
depends on NETFILTER_XTABLES_LEGACY
17+
default m if NETFILTER_XTABLES_LEGACY
1818
help
1919
iptables is a legacy packet classifier.
2020
This is not needed if you are using iptables over nftables
@@ -182,8 +182,8 @@ config IP_NF_MATCH_TTL
182182
# `filter', generic and specific targets
183183
config IP_NF_FILTER
184184
tristate "Packet filtering"
185-
default m if NETFILTER_ADVANCED=n
186-
select IP_NF_IPTABLES_LEGACY
185+
default m if NETFILTER_ADVANCED=n || IP_NF_IPTABLES_LEGACY
186+
depends on IP_NF_IPTABLES_LEGACY
187187
help
188188
Packet filtering defines a table `filter', which has a series of
189189
rules for simple packet filtering at local input, forwarding and
@@ -220,10 +220,10 @@ config IP_NF_TARGET_SYNPROXY
220220
config IP_NF_NAT
221221
tristate "iptables NAT support"
222222
depends on NF_CONNTRACK
223+
depends on IP_NF_IPTABLES_LEGACY
223224
default m if NETFILTER_ADVANCED=n
224225
select NF_NAT
225226
select NETFILTER_XT_NAT
226-
select IP_NF_IPTABLES_LEGACY
227227
help
228228
This enables the `nat' table in iptables. This allows masquerading,
229229
port forwarding and other forms of full Network Address Port
@@ -263,8 +263,8 @@ endif # IP_NF_NAT
263263
# mangle + specific targets
264264
config IP_NF_MANGLE
265265
tristate "Packet mangling"
266-
default m if NETFILTER_ADVANCED=n
267-
select IP_NF_IPTABLES_LEGACY
266+
default m if NETFILTER_ADVANCED=n || IP_NF_IPTABLES_LEGACY
267+
depends on IP_NF_IPTABLES_LEGACY
268268
help
269269
This option adds a `mangle' table to iptables: see the man page for
270270
iptables(8). This table is used for various packet alterations
@@ -299,7 +299,7 @@ config IP_NF_TARGET_TTL
299299
# raw + specific targets
300300
config IP_NF_RAW
301301
tristate 'raw table support (required for NOTRACK/TRACE)'
302-
select IP_NF_IPTABLES_LEGACY
302+
depends on IP_NF_IPTABLES_LEGACY
303303
help
304304
This option adds a `raw' table to iptables. This table is the very
305305
first in the netfilter framework and hooks in at the PREROUTING
@@ -313,7 +313,7 @@ config IP_NF_SECURITY
313313
tristate "Security table"
314314
depends on SECURITY
315315
depends on NETFILTER_ADVANCED
316-
select IP_NF_IPTABLES_LEGACY
316+
depends on IP_NF_IPTABLES_LEGACY
317317
help
318318
This option adds a `security' table to iptables, for use
319319
with Mandatory Access Control (MAC) policy.
@@ -325,8 +325,8 @@ endif # IP_NF_IPTABLES
325325
# ARP tables
326326
config IP_NF_ARPTABLES
327327
tristate "Legacy ARPTABLES support"
328-
depends on NETFILTER_XTABLES
329-
default n
328+
depends on NETFILTER_XTABLES_LEGACY
329+
default n
330330
help
331331
arptables is a legacy packet classifier.
332332
This is not needed if you are using arptables over nftables
@@ -342,7 +342,7 @@ config IP_NF_ARPFILTER
342342
tristate "arptables-legacy packet filtering support"
343343
select IP_NF_ARPTABLES
344344
select NETFILTER_FAMILY_ARP
345-
depends on NETFILTER_XTABLES
345+
depends on NETFILTER_XTABLES_LEGACY
346346
help
347347
ARP packet filtering defines a table `filter', which has a series of
348348
rules for simple ARP packet filtering at local input and

net/ipv6/netfilter/Kconfig

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ menu "IPv6: Netfilter Configuration"
99
# old sockopt interface and eval loop
1010
config IP6_NF_IPTABLES_LEGACY
1111
tristate "Legacy IP6 tables support"
12-
depends on INET && IPV6
13-
select NETFILTER_XTABLES
14-
default n
12+
depends on INET && IPV6 && NETFILTER_XTABLES_LEGACY
13+
default m if NETFILTER_XTABLES_LEGACY
1514
help
1615
ip6tables is a legacy packet classifier.
1716
This is not needed if you are using iptables over nftables
@@ -196,8 +195,8 @@ config IP6_NF_TARGET_HL
196195

197196
config IP6_NF_FILTER
198197
tristate "Packet filtering"
199-
default m if NETFILTER_ADVANCED=n
200-
select IP6_NF_IPTABLES_LEGACY
198+
default m if NETFILTER_ADVANCED=n || IP6_NF_IPTABLES_LEGACY
199+
depends on IP6_NF_IPTABLES_LEGACY
201200
tristate
202201
help
203202
Packet filtering defines a table `filter', which has a series of
@@ -233,8 +232,8 @@ config IP6_NF_TARGET_SYNPROXY
233232

234233
config IP6_NF_MANGLE
235234
tristate "Packet mangling"
236-
default m if NETFILTER_ADVANCED=n
237-
select IP6_NF_IPTABLES_LEGACY
235+
default m if NETFILTER_ADVANCED=n || IP6_NF_IPTABLES_LEGACY
236+
depends on IP6_NF_IPTABLES_LEGACY
238237
help
239238
This option adds a `mangle' table to iptables: see the man page for
240239
iptables(8). This table is used for various packet alterations
@@ -244,7 +243,7 @@ config IP6_NF_MANGLE
244243

245244
config IP6_NF_RAW
246245
tristate 'raw table support (required for TRACE)'
247-
select IP6_NF_IPTABLES_LEGACY
246+
depends on IP6_NF_IPTABLES_LEGACY
248247
help
249248
This option adds a `raw' table to ip6tables. This table is the very
250249
first in the netfilter framework and hooks in at the PREROUTING
@@ -258,7 +257,7 @@ config IP6_NF_SECURITY
258257
tristate "Security table"
259258
depends on SECURITY
260259
depends on NETFILTER_ADVANCED
261-
select IP6_NF_IPTABLES_LEGACY
260+
depends on IP6_NF_IPTABLES_LEGACY
262261
help
263262
This option adds a `security' table to iptables, for use
264263
with Mandatory Access Control (MAC) policy.
@@ -269,8 +268,8 @@ config IP6_NF_NAT
269268
tristate "ip6tables NAT support"
270269
depends on NF_CONNTRACK
271270
depends on NETFILTER_ADVANCED
271+
depends on IP6_NF_IPTABLES_LEGACY
272272
select NF_NAT
273-
select IP6_NF_IPTABLES_LEGACY
274273
select NETFILTER_XT_NAT
275274
help
276275
This enables the `nat' table in ip6tables. This allows masquerading,

net/netfilter/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,16 @@ config NETFILTER_XTABLES_COMPAT
758758

759759
If unsure, say N.
760760

761+
config NETFILTER_XTABLES_LEGACY
762+
bool "Netfilter legacy tables support"
763+
depends on !PREEMPT_RT
764+
help
765+
Say Y here if you still require support for legacy tables. This is
766+
required by the legacy tools (iptables-legacy) and is not needed if
767+
you use iptables over nftables (iptables-nft).
768+
Legacy support is not limited to IP, it also includes EBTABLES and
769+
ARPTABLES.
770+
761771
comment "Xtables combined modules"
762772

763773
config NETFILTER_XT_MARK

0 commit comments

Comments
 (0)