Skip to content

Commit 0613736

Browse files
committed
Merge tag 'nf-23-11-08' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf
Pablo Neira Ayuso says: ==================== Netfilter fixes for net The following patchset contains Netfilter fixes for net: 1) Add missing netfilter modules description to fix W=1, from Florian Westphal. 2) Fix catch-all element GC with timeout when use with the pipapo set backend, this remained broken since I tried to fix it this summer, then another attempt to fix it recently. 3) Add missing IPVS modules descriptions to fix W=1, also from Florian. 4) xt_recent allocated a too small buffer to store an IPv4-mapped IPv6 address which can be parsed by in6_pton(), from Maciej Zenczykowski. Broken for many releases. 5) Skip IPv4-mapped IPv6, IPv4-compat IPv6, site/link local scoped IPv6 addressses to set up IPv6 NAT redirect, also from Florian. This is broken since 2012. * tag 'nf-23-11-08' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf: netfilter: nat: fix ipv6 nat redirect with mapped and scoped addresses netfilter: xt_recent: fix (increase) ipv6 literal buffer length ipvs: add missing module descriptions netfilter: nf_tables: remove catchall element in GC sync path netfilter: add missing module descriptions ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 942b8b3 + 80abbe8 commit 0613736

40 files changed

+82
-7
lines changed

net/bridge/netfilter/ebtable_broute.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,4 @@ static void __exit ebtable_broute_fini(void)
135135
module_init(ebtable_broute_init);
136136
module_exit(ebtable_broute_fini);
137137
MODULE_LICENSE("GPL");
138+
MODULE_DESCRIPTION("Force packets to be routed instead of bridged");

net/bridge/netfilter/ebtable_filter.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,4 @@ static void __exit ebtable_filter_fini(void)
116116
module_init(ebtable_filter_init);
117117
module_exit(ebtable_filter_fini);
118118
MODULE_LICENSE("GPL");
119+
MODULE_DESCRIPTION("ebtables legacy filter table");

net/bridge/netfilter/ebtable_nat.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,4 @@ static void __exit ebtable_nat_fini(void)
116116
module_init(ebtable_nat_init);
117117
module_exit(ebtable_nat_fini);
118118
MODULE_LICENSE("GPL");
119+
MODULE_DESCRIPTION("ebtables legacy stateless nat table");

net/bridge/netfilter/ebtables.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2595,3 +2595,4 @@ EXPORT_SYMBOL(ebt_do_table);
25952595
module_init(ebtables_init);
25962596
module_exit(ebtables_fini);
25972597
MODULE_LICENSE("GPL");
2598+
MODULE_DESCRIPTION("ebtables legacy core");

net/bridge/netfilter/nf_conntrack_bridge.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,3 +416,4 @@ module_exit(nf_conntrack_l3proto_bridge_fini);
416416

417417
MODULE_ALIAS("nf_conntrack-" __stringify(AF_BRIDGE));
418418
MODULE_LICENSE("GPL");
419+
MODULE_DESCRIPTION("Bridge IPv4 and IPv6 connection tracking");

net/ipv4/netfilter/iptable_nat.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,4 @@ module_init(iptable_nat_init);
170170
module_exit(iptable_nat_exit);
171171

172172
MODULE_LICENSE("GPL");
173+
MODULE_DESCRIPTION("iptables legacy nat table");

net/ipv4/netfilter/iptable_raw.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,4 @@ static void __exit iptable_raw_fini(void)
108108
module_init(iptable_raw_init);
109109
module_exit(iptable_raw_fini);
110110
MODULE_LICENSE("GPL");
111+
MODULE_DESCRIPTION("iptables legacy raw table");

net/ipv4/netfilter/nf_defrag_ipv4.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,4 @@ module_init(nf_defrag_init);
186186
module_exit(nf_defrag_fini);
187187

188188
MODULE_LICENSE("GPL");
189+
MODULE_DESCRIPTION("IPv4 defragmentation support");

net/ipv4/netfilter/nf_reject_ipv4.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,3 +336,4 @@ void nf_send_unreach(struct sk_buff *skb_in, int code, int hook)
336336
EXPORT_SYMBOL_GPL(nf_send_unreach);
337337

338338
MODULE_LICENSE("GPL");
339+
MODULE_DESCRIPTION("IPv4 packet rejection core");

net/ipv6/netfilter/ip6table_nat.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,4 @@ module_init(ip6table_nat_init);
170170
module_exit(ip6table_nat_exit);
171171

172172
MODULE_LICENSE("GPL");
173+
MODULE_DESCRIPTION("Ip6tables legacy nat table");

net/ipv6/netfilter/ip6table_raw.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,4 @@ static void __exit ip6table_raw_fini(void)
106106
module_init(ip6table_raw_init);
107107
module_exit(ip6table_raw_fini);
108108
MODULE_LICENSE("GPL");
109+
MODULE_DESCRIPTION("Ip6tables legacy raw table");

net/ipv6/netfilter/nf_defrag_ipv6_hooks.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,4 @@ module_init(nf_defrag_init);
182182
module_exit(nf_defrag_fini);
183183

184184
MODULE_LICENSE("GPL");
185+
MODULE_DESCRIPTION("IPv6 defragmentation support");

net/ipv6/netfilter/nf_reject_ipv6.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,3 +413,4 @@ void nf_send_unreach6(struct net *net, struct sk_buff *skb_in,
413413
EXPORT_SYMBOL_GPL(nf_send_unreach6);
414414

415415
MODULE_LICENSE("GPL");
416+
MODULE_DESCRIPTION("IPv6 packet rejection core");

net/netfilter/ipvs/ip_vs_core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2450,3 +2450,4 @@ static void __exit ip_vs_cleanup(void)
24502450
module_init(ip_vs_init);
24512451
module_exit(ip_vs_cleanup);
24522452
MODULE_LICENSE("GPL");
2453+
MODULE_DESCRIPTION("IP Virtual Server");

net/netfilter/ipvs/ip_vs_dh.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,3 +270,4 @@ static void __exit ip_vs_dh_cleanup(void)
270270
module_init(ip_vs_dh_init);
271271
module_exit(ip_vs_dh_cleanup);
272272
MODULE_LICENSE("GPL");
273+
MODULE_DESCRIPTION("ipvs destination hashing scheduler");

net/netfilter/ipvs/ip_vs_fo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,4 @@ static void __exit ip_vs_fo_cleanup(void)
7272
module_init(ip_vs_fo_init);
7373
module_exit(ip_vs_fo_cleanup);
7474
MODULE_LICENSE("GPL");
75+
MODULE_DESCRIPTION("ipvs weighted failover scheduler");

net/netfilter/ipvs/ip_vs_ftp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,3 +635,4 @@ static void __exit ip_vs_ftp_exit(void)
635635
module_init(ip_vs_ftp_init);
636636
module_exit(ip_vs_ftp_exit);
637637
MODULE_LICENSE("GPL");
638+
MODULE_DESCRIPTION("ipvs ftp helper");

net/netfilter/ipvs/ip_vs_lblc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,3 +632,4 @@ static void __exit ip_vs_lblc_cleanup(void)
632632
module_init(ip_vs_lblc_init);
633633
module_exit(ip_vs_lblc_cleanup);
634634
MODULE_LICENSE("GPL");
635+
MODULE_DESCRIPTION("ipvs locality-based least-connection scheduler");

net/netfilter/ipvs/ip_vs_lblcr.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,3 +817,4 @@ static void __exit ip_vs_lblcr_cleanup(void)
817817
module_init(ip_vs_lblcr_init);
818818
module_exit(ip_vs_lblcr_cleanup);
819819
MODULE_LICENSE("GPL");
820+
MODULE_DESCRIPTION("ipvs locality-based least-connection with replication scheduler");

net/netfilter/ipvs/ip_vs_lc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,4 @@ static void __exit ip_vs_lc_cleanup(void)
8686
module_init(ip_vs_lc_init);
8787
module_exit(ip_vs_lc_cleanup);
8888
MODULE_LICENSE("GPL");
89+
MODULE_DESCRIPTION("ipvs least connection scheduler");

net/netfilter/ipvs/ip_vs_nq.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,4 @@ static void __exit ip_vs_nq_cleanup(void)
136136
module_init(ip_vs_nq_init);
137137
module_exit(ip_vs_nq_cleanup);
138138
MODULE_LICENSE("GPL");
139+
MODULE_DESCRIPTION("ipvs never queue scheduler");

net/netfilter/ipvs/ip_vs_ovf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,4 @@ static void __exit ip_vs_ovf_cleanup(void)
7979
module_init(ip_vs_ovf_init);
8080
module_exit(ip_vs_ovf_cleanup);
8181
MODULE_LICENSE("GPL");
82+
MODULE_DESCRIPTION("ipvs overflow connection scheduler");

net/netfilter/ipvs/ip_vs_pe_sip.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,4 @@ static void __exit ip_vs_sip_cleanup(void)
185185
module_init(ip_vs_sip_init);
186186
module_exit(ip_vs_sip_cleanup);
187187
MODULE_LICENSE("GPL");
188+
MODULE_DESCRIPTION("ipvs sip helper");

net/netfilter/ipvs/ip_vs_rr.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,5 @@ static void __exit ip_vs_rr_cleanup(void)
122122

123123
module_init(ip_vs_rr_init);
124124
module_exit(ip_vs_rr_cleanup);
125+
MODULE_DESCRIPTION("ipvs round-robin scheduler");
125126
MODULE_LICENSE("GPL");

net/netfilter/ipvs/ip_vs_sed.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,4 @@ static void __exit ip_vs_sed_cleanup(void)
137137
module_init(ip_vs_sed_init);
138138
module_exit(ip_vs_sed_cleanup);
139139
MODULE_LICENSE("GPL");
140+
MODULE_DESCRIPTION("ipvs shortest expected delay scheduler");

net/netfilter/ipvs/ip_vs_sh.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,3 +376,4 @@ static void __exit ip_vs_sh_cleanup(void)
376376
module_init(ip_vs_sh_init);
377377
module_exit(ip_vs_sh_cleanup);
378378
MODULE_LICENSE("GPL");
379+
MODULE_DESCRIPTION("ipvs source hashing scheduler");

net/netfilter/ipvs/ip_vs_twos.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,4 @@ static void __exit ip_vs_twos_cleanup(void)
137137
module_init(ip_vs_twos_init);
138138
module_exit(ip_vs_twos_cleanup);
139139
MODULE_LICENSE("GPL");
140+
MODULE_DESCRIPTION("ipvs power of twos choice scheduler");

net/netfilter/ipvs/ip_vs_wlc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,4 @@ static void __exit ip_vs_wlc_cleanup(void)
109109
module_init(ip_vs_wlc_init);
110110
module_exit(ip_vs_wlc_cleanup);
111111
MODULE_LICENSE("GPL");
112+
MODULE_DESCRIPTION("ipvs weighted least connection scheduler");

net/netfilter/ipvs/ip_vs_wrr.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,3 +263,4 @@ static void __exit ip_vs_wrr_cleanup(void)
263263
module_init(ip_vs_wrr_init);
264264
module_exit(ip_vs_wrr_cleanup);
265265
MODULE_LICENSE("GPL");
266+
MODULE_DESCRIPTION("ipvs weighted round-robin scheduler");

net/netfilter/nf_conntrack_broadcast.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,4 @@ int nf_conntrack_broadcast_help(struct sk_buff *skb,
8282
EXPORT_SYMBOL_GPL(nf_conntrack_broadcast_help);
8383

8484
MODULE_LICENSE("GPL");
85+
MODULE_DESCRIPTION("Broadcast connection tracking helper");

net/netfilter/nf_conntrack_netlink.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#include "nf_internals.h"
5858

5959
MODULE_LICENSE("GPL");
60+
MODULE_DESCRIPTION("List and change connection tracking table");
6061

6162
struct ctnetlink_list_dump_ctx {
6263
struct nf_conn *last;

net/netfilter/nf_conntrack_proto.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,3 +699,4 @@ MODULE_ALIAS("ip_conntrack");
699699
MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET));
700700
MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET6));
701701
MODULE_LICENSE("GPL");
702+
MODULE_DESCRIPTION("IPv4 and IPv6 connection tracking");

net/netfilter/nf_nat_core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,7 @@ static void __exit nf_nat_cleanup(void)
12631263
}
12641264

12651265
MODULE_LICENSE("GPL");
1266+
MODULE_DESCRIPTION("Network address translation core");
12661267

12671268
module_init(nf_nat_init);
12681269
module_exit(nf_nat_cleanup);

net/netfilter/nf_nat_redirect.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,26 @@ EXPORT_SYMBOL_GPL(nf_nat_redirect_ipv4);
8080

8181
static const struct in6_addr loopback_addr = IN6ADDR_LOOPBACK_INIT;
8282

83+
static bool nf_nat_redirect_ipv6_usable(const struct inet6_ifaddr *ifa, unsigned int scope)
84+
{
85+
unsigned int ifa_addr_type = ipv6_addr_type(&ifa->addr);
86+
87+
if (ifa_addr_type & IPV6_ADDR_MAPPED)
88+
return false;
89+
90+
if ((ifa->flags & IFA_F_TENTATIVE) && (!(ifa->flags & IFA_F_OPTIMISTIC)))
91+
return false;
92+
93+
if (scope) {
94+
unsigned int ifa_scope = ifa_addr_type & IPV6_ADDR_SCOPE_MASK;
95+
96+
if (!(scope & ifa_scope))
97+
return false;
98+
}
99+
100+
return true;
101+
}
102+
83103
unsigned int
84104
nf_nat_redirect_ipv6(struct sk_buff *skb, const struct nf_nat_range2 *range,
85105
unsigned int hooknum)
@@ -89,14 +109,19 @@ nf_nat_redirect_ipv6(struct sk_buff *skb, const struct nf_nat_range2 *range,
89109
if (hooknum == NF_INET_LOCAL_OUT) {
90110
newdst.in6 = loopback_addr;
91111
} else {
112+
unsigned int scope = ipv6_addr_scope(&ipv6_hdr(skb)->daddr);
92113
struct inet6_dev *idev;
93-
struct inet6_ifaddr *ifa;
94114
bool addr = false;
95115

96116
idev = __in6_dev_get(skb->dev);
97117
if (idev != NULL) {
118+
const struct inet6_ifaddr *ifa;
119+
98120
read_lock_bh(&idev->lock);
99121
list_for_each_entry(ifa, &idev->addr_list, if_list) {
122+
if (!nf_nat_redirect_ipv6_usable(ifa, scope))
123+
continue;
124+
100125
newdst.in6 = ifa->addr;
101126
addr = true;
102127
break;

net/netfilter/nf_tables_api.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6520,6 +6520,12 @@ static int nft_setelem_deactivate(const struct net *net,
65206520
return ret;
65216521
}
65226522

6523+
static void nft_setelem_catchall_destroy(struct nft_set_elem_catchall *catchall)
6524+
{
6525+
list_del_rcu(&catchall->list);
6526+
kfree_rcu(catchall, rcu);
6527+
}
6528+
65236529
static void nft_setelem_catchall_remove(const struct net *net,
65246530
const struct nft_set *set,
65256531
struct nft_elem_priv *elem_priv)
@@ -6528,8 +6534,7 @@ static void nft_setelem_catchall_remove(const struct net *net,
65286534

65296535
list_for_each_entry_safe(catchall, next, &set->catchall_list, list) {
65306536
if (catchall->elem == elem_priv) {
6531-
list_del_rcu(&catchall->list);
6532-
kfree_rcu(catchall, rcu);
6537+
nft_setelem_catchall_destroy(catchall);
65336538
break;
65346539
}
65356540
}
@@ -9678,11 +9683,12 @@ static struct nft_trans_gc *nft_trans_gc_catchall(struct nft_trans_gc *gc,
96789683
unsigned int gc_seq,
96799684
bool sync)
96809685
{
9681-
struct nft_set_elem_catchall *catchall;
9686+
struct nft_set_elem_catchall *catchall, *next;
96829687
const struct nft_set *set = gc->set;
9688+
struct nft_elem_priv *elem_priv;
96839689
struct nft_set_ext *ext;
96849690

9685-
list_for_each_entry_rcu(catchall, &set->catchall_list, list) {
9691+
list_for_each_entry_safe(catchall, next, &set->catchall_list, list) {
96869692
ext = nft_set_elem_ext(set, catchall->elem);
96879693

96889694
if (!nft_set_elem_expired(ext))
@@ -9700,7 +9706,13 @@ static struct nft_trans_gc *nft_trans_gc_catchall(struct nft_trans_gc *gc,
97009706
if (!gc)
97019707
return NULL;
97029708

9703-
nft_trans_gc_elem_add(gc, catchall->elem);
9709+
elem_priv = catchall->elem;
9710+
if (sync) {
9711+
nft_setelem_data_deactivate(gc->net, gc->set, elem_priv);
9712+
nft_setelem_catchall_destroy(catchall);
9713+
}
9714+
9715+
nft_trans_gc_elem_add(gc, elem_priv);
97049716
}
97059717

97069718
return gc;
@@ -11386,4 +11398,5 @@ module_exit(nf_tables_module_exit);
1138611398

1138711399
MODULE_LICENSE("GPL");
1138811400
MODULE_AUTHOR("Patrick McHardy <[email protected]>");
11401+
MODULE_DESCRIPTION("Framework for packet filtering and classification");
1138911402
MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_NFTABLES);

net/netfilter/nfnetlink_osf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,4 +447,5 @@ module_init(nfnl_osf_init);
447447
module_exit(nfnl_osf_fini);
448448

449449
MODULE_LICENSE("GPL");
450+
MODULE_DESCRIPTION("Passive OS fingerprint matching");
450451
MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_OSF);

net/netfilter/nft_chain_nat.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ module_init(nft_chain_nat_init);
137137
module_exit(nft_chain_nat_exit);
138138

139139
MODULE_LICENSE("GPL");
140+
MODULE_DESCRIPTION("nftables network address translation support");
140141
#ifdef CONFIG_NF_TABLES_IPV4
141142
MODULE_ALIAS_NFT_CHAIN(AF_INET, "nat");
142143
#endif

net/netfilter/nft_fib.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,5 @@ bool nft_fib_reduce(struct nft_regs_track *track,
204204
EXPORT_SYMBOL_GPL(nft_fib_reduce);
205205

206206
MODULE_LICENSE("GPL");
207+
MODULE_DESCRIPTION("Query routing table from nftables");
207208
MODULE_AUTHOR("Florian Westphal <[email protected]>");

net/netfilter/nft_fwd_netdev.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,4 +270,5 @@ module_exit(nft_fwd_netdev_module_exit);
270270

271271
MODULE_LICENSE("GPL");
272272
MODULE_AUTHOR("Pablo Neira Ayuso <[email protected]>");
273+
MODULE_DESCRIPTION("nftables netdev packet forwarding support");
273274
MODULE_ALIAS_NFT_AF_EXPR(5, "fwd");

net/netfilter/xt_recent.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ recent_mt_proc_write(struct file *file, const char __user *input,
561561
{
562562
struct recent_table *t = pde_data(file_inode(file));
563563
struct recent_entry *e;
564-
char buf[sizeof("+b335:1d35:1e55:dead:c0de:1715:5afe:c0de")];
564+
char buf[sizeof("+b335:1d35:1e55:dead:c0de:1715:255.255.255.255")];
565565
const char *c = buf;
566566
union nf_inet_addr addr = {};
567567
u_int16_t family;

0 commit comments

Comments
 (0)