Netfilter fixes for net
Subsystems (5)
Pablo Neira Ayuso
maintainercover Netfilter fixes for net
Hi,
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.
Please, pull these changes from:
git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git nf-23-11-08
Thanks.
----------------------------------------------------------------
The following changes since commit d93f9528573e1d419b69ca5ff4130201d05f6b90:
nfsd: regenerate user space parsers after ynl-gen changes (2023-11-06 09:03:46 +0000)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git tags/nf-23-11-08
for you to fetch changes up to 80abbe8a8263106fe45a4f293b92b5c74cc9cc8a:
netfilter: nat: fix ipv6 nat redirect with mapped and scoped addresses (2023-11-08 16:40:30 +0100)
----------------------------------------------------------------
netfilter pull request 23-11-08
----------------------------------------------------------------
Florian Westphal (3):
netfilter: add missing module descriptions
ipvs: add missing module descriptions
netfilter: nat: fix ipv6 nat redirect with mapped and scoped addresses
Maciej Żenczykowski (1):
netfilter: xt_recent: fix (increase) ipv6 literal buffer length
Pablo Neira Ayuso (1):
netfilter: nf_tables: remove catchall element in GC sync path
net/bridge/netfilter/ebtable_broute.c | 1 + net/bridge/netfilter/ebtable_filter.c | 1 + net/bridge/netfilter/ebtable_nat.c | 1 + net/bridge/netfilter/ebtables.c | 1 + net/bridge/netfilter/nf_conntrack_bridge.c | 1 + net/ipv4/netfilter/iptable_nat.c | 1 + net/ipv4/netfilter/iptable_raw.c | 1 + net/ipv4/netfilter/nf_defrag_ipv4.c | 1 + net/ipv4/netfilter/nf_reject_ipv4.c | 1 + net/ipv6/netfilter/ip6table_nat.c | 1 + net/ipv6/netfilter/ip6table_raw.c | 1 + net/ipv6/netfilter/nf_defrag_ipv6_hooks.c | 1 + net/ipv6/netfilter/nf_reject_ipv6.c | 1 + net/netfilter/ipvs/ip_vs_core.c | 1 + net/netfilter/ipvs/ip_vs_dh.c | 1 + net/netfilter/ipvs/ip_vs_fo.c | 1 + net/netfilter/ipvs/ip_vs_ftp.c | 1 + net/netfilter/ipvs/ip_vs_lblc.c | 1 + net/netfilter/ipvs/ip_vs_lblcr.c | 1 + net/netfilter/ipvs/ip_vs_lc.c | 1 + net/netfilter/ipvs/ip_vs_nq.c | 1 + net/netfilter/ipvs/ip_vs_ovf.c | 1 + net/netfilter/ipvs/ip_vs_pe_sip.c | 1 + net/netfilter/ipvs/ip_vs_rr.c | 1 + net/netfilter/ipvs/ip_vs_sed.c | 1 + net/netfilter/ipvs/ip_vs_sh.c | 1 + net/netfilter/ipvs/ip_vs_twos.c | 1 + net/netfilter/ipvs/ip_vs_wlc.c | 1 + net/netfilter/ipvs/ip_vs_wrr.c | 1 + net/netfilter/nf_conntrack_broadcast.c | 1 + net/netfilter/nf_conntrack_netlink.c | 1 + net/netfilter/nf_conntrack_proto.c | 1 + net/netfilter/nf_nat_core.c | 1 + net/netfilter/nf_nat_redirect.c | 27 ++++++++++++++++++++++++++- net/netfilter/nf_tables_api.c | 23 ++++++++++++++++++----- net/netfilter/nfnetlink_osf.c | 1 + net/netfilter/nft_chain_nat.c | 1 + net/netfilter/nft_fib.c | 1 + net/netfilter/nft_fwd_netdev.c | 1 + net/netfilter/xt_recent.c | 2 +- 40 files changed, 82 insertions(+), 7 deletions(-)
Pablo Neira Ayuso
maintainerPATCH 1/5 netfilter: add missing module descriptions
From: Florian Westphal <[email protected]>
W=1 builds warn on missing MODULE_DESCRIPTION, add them.
--- net/bridge/netfilter/ebtable_broute.c | 1 + net/bridge/netfilter/ebtable_filter.c | 1 + net/bridge/netfilter/ebtable_nat.c | 1 + net/bridge/netfilter/ebtables.c | 1 + net/bridge/netfilter/nf_conntrack_bridge.c | 1 + net/ipv4/netfilter/iptable_nat.c | 1 + net/ipv4/netfilter/iptable_raw.c | 1 + net/ipv4/netfilter/nf_defrag_ipv4.c | 1 + net/ipv4/netfilter/nf_reject_ipv4.c | 1 + net/ipv6/netfilter/ip6table_nat.c | 1 + net/ipv6/netfilter/ip6table_raw.c | 1 + net/ipv6/netfilter/nf_defrag_ipv6_hooks.c | 1 + net/ipv6/netfilter/nf_reject_ipv6.c | 1 + net/netfilter/nf_conntrack_broadcast.c | 1 + net/netfilter/nf_conntrack_netlink.c | 1 + net/netfilter/nf_conntrack_proto.c | 1 + net/netfilter/nf_nat_core.c | 1 + net/netfilter/nf_tables_api.c | 1 + net/netfilter/nfnetlink_osf.c | 1 + net/netfilter/nft_chain_nat.c | 1 + net/netfilter/nft_fib.c | 1 + net/netfilter/nft_fwd_netdev.c | 1 + 22 files changed, 22 insertions(+)
net/bridge/netfilter/ebtable_broute.c +1 -0
@@ -135,3 +135,4 @@ static void __exit ebtable_broute_fini(void)module_init (ebtable_broute_init);module_exit (ebtable_broute_fini);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("Force packets to be routed instead of bridged" );
net/bridge/netfilter/ebtable_filter.c +1 -0
@@ -116,3 +116,4 @@ static void __exit ebtable_filter_fini(void)module_init (ebtable_filter_init);module_exit (ebtable_filter_fini);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("ebtables legacy filter table" );
net/bridge/netfilter/ebtable_nat.c +1 -0
@@ -116,3 +116,4 @@ static void __exit ebtable_nat_fini(void)module_init (ebtable_nat_init);module_exit (ebtable_nat_fini);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("ebtables legacy stateless nat table" );
net/bridge/netfilter/ebtables.c +1 -0
@@ -2595,3 +2595,4 @@ EXPORT_SYMBOL(ebt_do_table);module_init (ebtables_init);module_exit (ebtables_fini);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("ebtables legacy core" );
net/bridge/netfilter/nf_conntrack_bridge.c +1 -0
@@ -416,3 +416,4 @@ module_exit(nf_conntrack_l3proto_bridge_fini);MODULE_ALIAS ("nf_conntrack-" __stringify(AF_BRIDGE ));MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("Bridge IPv4 and IPv6 connection tracking" );
net/ipv4/netfilter/iptable_nat.c +1 -0
@@ -170,3 +170,4 @@ module_init(iptable_nat_init);module_exit (iptable_nat_exit);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("iptables legacy nat table" );
net/ipv4/netfilter/iptable_raw.c +1 -0
@@ -108,3 +108,4 @@ static void __exit iptable_raw_fini(void)module_init (iptable_raw_init);module_exit (iptable_raw_fini);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("iptables legacy raw table" );
net/ipv4/netfilter/nf_defrag_ipv4.c +1 -0
@@ -186,3 +186,4 @@ module_init(nf_defrag_init);module_exit (nf_defrag_fini);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("IPv4 defragmentation support" );
net/ipv4/netfilter/nf_reject_ipv4.c +1 -0
@@ -336,3 +336,4 @@ void nf_send_unreach(struct sk_buff *skb_in, int code, int hook)EXPORT_SYMBOL_GPL (nf_send_unreach);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("IPv4 packet rejection core" );
net/ipv6/netfilter/ip6table_nat.c +1 -0
@@ -170,3 +170,4 @@ module_init(ip6table_nat_init);module_exit (ip6table_nat_exit);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("Ip6tables legacy nat table" );
net/ipv6/netfilter/ip6table_raw.c +1 -0
@@ -106,3 +106,4 @@ static void __exit ip6table_raw_fini(void)module_init (ip6table_raw_init);module_exit (ip6table_raw_fini);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("Ip6tables legacy raw table" );
net/ipv6/netfilter/nf_defrag_ipv6_hooks.c +1 -0
@@ -182,3 +182,4 @@ module_init(nf_defrag_init);module_exit (nf_defrag_fini);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("IPv6 defragmentation support" );
net/ipv6/netfilter/nf_reject_ipv6.c +1 -0
@@ -413,3 +413,4 @@ void nf_send_unreach6(struct net *net, struct sk_buff *skb_in,EXPORT_SYMBOL_GPL (nf_send_unreach6);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("IPv6 packet rejection core" );
net/netfilter/nf_conntrack_broadcast.c +1 -0
@@ -82,3 +82,4 @@ int nf_conntrack_broadcast_help(struct sk_buff *skb,EXPORT_SYMBOL_GPL (nf_conntrack_broadcast_help);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("Broadcast connection tracking helper" );
net/netfilter/nf_conntrack_netlink.c +1 -0
@@ -57,6 +57,7 @@#include "nf_internals.h" MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("List and change connection tracking table" );struct ctnetlink_list_dump_ctx {struct nf_conn *last;
net/netfilter/nf_conntrack_proto.c +1 -0
@@ -699,3 +699,4 @@ MODULE_ALIAS("ip_conntrack");MODULE_ALIAS ("nf_conntrack-" __stringify(AF_INET ));MODULE_ALIAS ("nf_conntrack-" __stringify(AF_INET6 ));MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("IPv4 and IPv6 connection tracking" );
net/netfilter/nf_nat_core.c +1 -0
@@ -1263,6 +1263,7 @@ static void __exit nf_nat_cleanup(void) }MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("Network address translation core" );module_init (nf_nat_init);module_exit (nf_nat_cleanup);
net/netfilter/nf_tables_api.c +1 -0
@@ -11386,4 +11386,5 @@ module_exit(nf_tables_module_exit);MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Patrick McHardy <[email protected]>" ); +MODULE_DESCRIPTION ("Framework for packet filtering and classification" );MODULE_ALIAS_NFNL_SUBSYS (NFNL_SUBSYS_NFTABLES );
net/netfilter/nfnetlink_osf.c +1 -0
@@ -447,4 +447,5 @@ module_init(nfnl_osf_init);module_exit (nfnl_osf_fini);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("Passive OS fingerprint matching" );MODULE_ALIAS_NFNL_SUBSYS (NFNL_SUBSYS_OSF );
net/netfilter/nft_chain_nat.c +1 -0
@@ -137,6 +137,7 @@ module_init(nft_chain_nat_init);module_exit (nft_chain_nat_exit);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("nftables network address translation support" );#ifdef CONFIG_NF_TABLES_IPV4 MODULE_ALIAS_NFT_CHAIN (AF_INET ,"nat" );#endif
net/netfilter/nft_fib.c +1 -0
@@ -204,4 +204,5 @@ bool nft_fib_reduce(struct nft_regs_track *track,EXPORT_SYMBOL_GPL (nft_fib_reduce);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("Query routing table from nftables" );MODULE_AUTHOR ("Florian Westphal <[email protected]>" );
net/netfilter/nft_fwd_netdev.c +1 -0
@@ -270,4 +270,5 @@ module_exit(nft_fwd_netdev_module_exit);MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Pablo Neira Ayuso <[email protected]>" ); +MODULE_DESCRIPTION ("nftables netdev packet forwarding support" );MODULE_ALIAS_NFT_AF_EXPR (5 ,"fwd" );
Signature · 1 line
2.30.2
Re: [PATCH net 1/5] netfilter: add missing module descriptions
This series was applied to netdev/net.git (main) by Pablo Neira Ayuso <[email protected]>:
Hello:
This series was applied to netdev/net.git (main)
by Pablo Neira Ayuso <[email protected]>:
Quoted 8 lines · On Wed, 8 Nov 2023 16:57:58 +0100 you wrote:
From: Florian Westphal <[email protected]>
W=1 builds warn on missing
MODULE_DESCRIPTION, add them.Signed-off-by Florian Westphal <[email protected]>Signed-off-by Pablo Neira Ayuso <[email protected]>[...]
Here is the summary with links:
- [net,1/5] netfilter: add missing module descriptions
https://git.kernel.org/netdev/net/c/94090b23f3f7 - [net,2/5] netfilter: nf_tables: remove catchall element in GC sync path https://git.kernel.org/netdev/net/c/93995bf4af2c - [net,3/5] ipvs: add missing module descriptions https://git.kernel.org/netdev/net/c/17cd01e4d1e3 - [net,4/5] netfilter: xt_recent: fix (increase) ipv6 literal buffer length https://git.kernel.org/netdev/net/c/7b308feb4fd2 - [net,5/5] netfilter: nat: fix ipv6 nat redirect with mapped and scoped addresses https://git.kernel.org/netdev/net/c/80abbe8a8263
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Pablo Neira Ayuso
maintainerPATCH 2/5 netfilter: nf_tables: remove catchall element in GC sync path
In reply to Pablo Neira AyusoThe expired catchall element is not deactivated and removed from GC sync path. This path holds mutex so just call nft_setelem_data_deactivate() and nft_setelem_catchall_remove() before queueing the GC work.
--- net/netfilter/nf_tables_api.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
net/netfilter/nf_tables_api.c +17 -5
@@ -6520,6 +6520,12 @@ static int nft_setelem_deactivate(const struct net *net,return ret; } +static void nft_setelem_catchall_destroy (struct nft_set_elem_catchall *catchall) +{ +list_del_rcu (&catchall->list); +kfree_rcu (catchall, rcu); +} +static void nft_setelem_catchall_remove (const struct net *net,const struct nft_set *set,struct nft_elem_priv *elem_priv)
@@ -6528,8 +6534,7 @@ static void nft_setelem_catchall_remove(const struct net *net,list_for_each_entry_safe (catchall, next, &set->catchall_list, list) {if (catchall->elem == elem_priv) { -list_del_rcu (&catchall->list); -kfree_rcu (catchall, rcu); +nft_setelem_catchall_destroy (catchall);break ; } }
@@ -9678,11 +9683,12 @@ static struct nft_trans_gc *nft_trans_gc_catchall(struct nft_trans_gc *gc, unsigned int gc_seq, bool sync) { -struct nft_set_elem_catchall *catchall; +struct nft_set_elem_catchall *catchall, *next;const struct nft_set *set = gc->set; +struct nft_elem_priv *elem_priv;struct nft_set_ext *ext; -list_for_each_entry_rcu (catchall, &set->catchall_list, list) { +list_for_each_entry_safe (catchall, next, &set->catchall_list, list) { ext =nft_set_elem_ext (set, catchall->elem);if (!nft_set_elem_expired (ext))
@@ -9700,7 +9706,13 @@ static struct nft_trans_gc *nft_trans_gc_catchall(struct nft_trans_gc *gc,if (!gc)return NULL ; -nft_trans_gc_elem_add (gc, catchall->elem); + elem_priv = catchall->elem; +if (sync) { +nft_setelem_data_deactivate (gc->net, gc->set, elem_priv); +nft_setelem_catchall_destroy (catchall); + } + +nft_trans_gc_elem_add (gc, elem_priv); }return gc;
Signature · 1 line
2.30.2
Pablo Neira Ayuso
maintainerPATCH 3/5 ipvs: add missing module descriptions
In reply to Pablo Neira AyusoFrom: Florian Westphal <[email protected]>
W=1 builds warn on missing MODULE_DESCRIPTION, add them.
--- net/netfilter/ipvs/ip_vs_core.c | 1 + net/netfilter/ipvs/ip_vs_dh.c | 1 + net/netfilter/ipvs/ip_vs_fo.c | 1 + net/netfilter/ipvs/ip_vs_ftp.c | 1 + net/netfilter/ipvs/ip_vs_lblc.c | 1 + net/netfilter/ipvs/ip_vs_lblcr.c | 1 + net/netfilter/ipvs/ip_vs_lc.c | 1 + net/netfilter/ipvs/ip_vs_nq.c | 1 + net/netfilter/ipvs/ip_vs_ovf.c | 1 + net/netfilter/ipvs/ip_vs_pe_sip.c | 1 + net/netfilter/ipvs/ip_vs_rr.c | 1 + net/netfilter/ipvs/ip_vs_sed.c | 1 + net/netfilter/ipvs/ip_vs_sh.c | 1 + net/netfilter/ipvs/ip_vs_twos.c | 1 + net/netfilter/ipvs/ip_vs_wlc.c | 1 + net/netfilter/ipvs/ip_vs_wrr.c | 1 + 16 files changed, 16 insertions(+)
net/netfilter/ipvs/ip_vs_core.c +1 -0
@@ -2450,3 +2450,4 @@ static void __exit ip_vs_cleanup(void)module_init (ip_vs_init);module_exit (ip_vs_cleanup);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("IP Virtual Server" );
net/netfilter/ipvs/ip_vs_dh.c +1 -0
@@ -270,3 +270,4 @@ static void __exit ip_vs_dh_cleanup(void)module_init (ip_vs_dh_init);module_exit (ip_vs_dh_cleanup);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("ipvs destination hashing scheduler" );
net/netfilter/ipvs/ip_vs_fo.c +1 -0
@@ -72,3 +72,4 @@ static void __exit ip_vs_fo_cleanup(void)module_init (ip_vs_fo_init);module_exit (ip_vs_fo_cleanup);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("ipvs weighted failover scheduler" );
net/netfilter/ipvs/ip_vs_ftp.c +1 -0
@@ -635,3 +635,4 @@ static void __exit ip_vs_ftp_exit(void)module_init (ip_vs_ftp_init);module_exit (ip_vs_ftp_exit);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("ipvs ftp helper" );
net/netfilter/ipvs/ip_vs_lblc.c +1 -0
@@ -632,3 +632,4 @@ static void __exit ip_vs_lblc_cleanup(void)module_init (ip_vs_lblc_init);module_exit (ip_vs_lblc_cleanup);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("ipvs locality-based least-connection scheduler" );
net/netfilter/ipvs/ip_vs_lblcr.c +1 -0
@@ -817,3 +817,4 @@ static void __exit ip_vs_lblcr_cleanup(void)module_init (ip_vs_lblcr_init);module_exit (ip_vs_lblcr_cleanup);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("ipvs locality-based least-connection with replication scheduler" );
net/netfilter/ipvs/ip_vs_lc.c +1 -0
@@ -86,3 +86,4 @@ static void __exit ip_vs_lc_cleanup(void)module_init (ip_vs_lc_init);module_exit (ip_vs_lc_cleanup);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("ipvs least connection scheduler" );
net/netfilter/ipvs/ip_vs_nq.c +1 -0
@@ -136,3 +136,4 @@ static void __exit ip_vs_nq_cleanup(void)module_init (ip_vs_nq_init);module_exit (ip_vs_nq_cleanup);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("ipvs never queue scheduler" );
net/netfilter/ipvs/ip_vs_ovf.c +1 -0
@@ -79,3 +79,4 @@ static void __exit ip_vs_ovf_cleanup(void)module_init (ip_vs_ovf_init);module_exit (ip_vs_ovf_cleanup);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("ipvs overflow connection scheduler" );
net/netfilter/ipvs/ip_vs_pe_sip.c +1 -0
@@ -185,3 +185,4 @@ static void __exit ip_vs_sip_cleanup(void)module_init (ip_vs_sip_init);module_exit (ip_vs_sip_cleanup);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("ipvs sip helper" );
net/netfilter/ipvs/ip_vs_rr.c +1 -0
@@ -122,4 +122,5 @@ static void __exit ip_vs_rr_cleanup(void)module_init (ip_vs_rr_init);module_exit (ip_vs_rr_cleanup); +MODULE_DESCRIPTION ("ipvs round-robin scheduler" );MODULE_LICENSE ("GPL" );
net/netfilter/ipvs/ip_vs_sed.c +1 -0
@@ -137,3 +137,4 @@ static void __exit ip_vs_sed_cleanup(void)module_init (ip_vs_sed_init);module_exit (ip_vs_sed_cleanup);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("ipvs shortest expected delay scheduler" );
net/netfilter/ipvs/ip_vs_sh.c +1 -0
@@ -376,3 +376,4 @@ static void __exit ip_vs_sh_cleanup(void)module_init (ip_vs_sh_init);module_exit (ip_vs_sh_cleanup);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("ipvs source hashing scheduler" );
net/netfilter/ipvs/ip_vs_twos.c +1 -0
@@ -137,3 +137,4 @@ static void __exit ip_vs_twos_cleanup(void)module_init (ip_vs_twos_init);module_exit (ip_vs_twos_cleanup);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("ipvs power of twos choice scheduler" );
net/netfilter/ipvs/ip_vs_wlc.c +1 -0
@@ -109,3 +109,4 @@ static void __exit ip_vs_wlc_cleanup(void)module_init (ip_vs_wlc_init);module_exit (ip_vs_wlc_cleanup);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("ipvs weighted least connection scheduler" );
net/netfilter/ipvs/ip_vs_wrr.c +1 -0
@@ -263,3 +263,4 @@ static void __exit ip_vs_wrr_cleanup(void)module_init (ip_vs_wrr_init);module_exit (ip_vs_wrr_cleanup);MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("ipvs weighted round-robin scheduler" );
Signature · 1 line
2.30.2
Pablo Neira Ayuso
maintainerPATCH 4/5 netfilter: xt_recent: fix (increase) ipv6 literal buffer length
In reply to Pablo Neira AyusoFrom: Maciej Żenczykowski <[email protected]>
in6_pton() supports 'low-32-bit dot-decimal representation' (this is useful with DNS64/NAT64 networks for example):
# echo +aaaa:bbbb:cccc:dddd:eeee:ffff:1.2.3.4 > /proc/self/net/xt_recent/DEFAULT # cat /proc/self/net/xt_recent/DEFAULT src=aaaa:bbbb:cccc:dddd:eeee:ffff:0102:0304 ttl: 0 last_seen: 9733848829 oldest_pkt: 1 9733848829
but the provided buffer is too short:
# echo +aaaa:bbbb:cccc:dddd:eeee:ffff:255.255.255.255 > /proc/self/net/xt_recent/DEFAULT -bash: echo: write error: Invalid argument
--- net/netfilter/xt_recent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/xt_recent.c +1 -1
@@ -561,7 +561,7 @@ recent_mt_proc_write(struct file *file, const char __user *input, {struct recent_table *t =pde_data (file_inode (file));struct recent_entry *e; -char buf[sizeof ("+b335:1d35:1e55:dead:c0de:1715:5afe:c0de" )]; +char buf[sizeof ("+b335:1d35:1e55:dead:c0de:1715:255.255.255.255" )];const char *c = buf;union nf_inet_addr addr = {};u_int16_t family;
Signature · 1 line
2.30.2
Pablo Neira Ayuso
maintainerPATCH 5/5 netfilter: nat: fix ipv6 nat redirect with mapped and scoped addresses
In reply to Pablo Neira AyusoFrom: Florian Westphal <[email protected]>
The ipv6 redirect target was derived from the ipv4 one, i.e. its identical to a 'dnat' with the first (primary) address assigned to the network interface. The code has been moved around to make it usable from nf_tables too, but its still the same as it was back when this was added in 2012.
IPv6, however, has different types of addresses, if the 'wrong' address comes first the redirection does not work.
In Daniels case, the addresses are:
inet6 ::ffff:192 ...
inet6 2a01: ...
... so the function attempts to redirect to the mapped address.
Add more checks before the address is deemed correct:
1. If the packets' daddr is scoped, search for a scoped address too
2. skip tentative addresses
3. skip mapped addresses
Use the first address that appears to match our needs.
--- net/netfilter/nf_nat_redirect.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
net/netfilter/nf_nat_redirect.c +26 -1
@@ -80,6 +80,26 @@ EXPORT_SYMBOL_GPL(nf_nat_redirect_ipv4);static const struct in6_addr loopback_addr =IN6ADDR_LOOPBACK_INIT ; +static bool nf_nat_redirect_ipv6_usable (const struct inet6_ifaddr *ifa,unsigned int scope) +{ +unsigned int ifa_addr_type =ipv6_addr_type (&ifa->addr); + +if (ifa_addr_type &IPV6_ADDR_MAPPED ) +return false; + +if ((ifa->flags &IFA_F_TENTATIVE ) && (!(ifa->flags &IFA_F_OPTIMISTIC ))) +return false; + +if (scope) { +unsigned int ifa_scope = ifa_addr_type &IPV6_ADDR_SCOPE_MASK ; + +if (!(scope & ifa_scope)) +return false; + } + +return true; +} +unsigned int nf_nat_redirect_ipv6 (struct sk_buff *skb,const struct nf_nat_range2 *range,unsigned int hooknum)
@@ -89,14 +109,19 @@ nf_nat_redirect_ipv6(struct sk_buff *skb, const struct nf_nat_range2 *range,if (hooknum ==NF_INET_LOCAL_OUT ) { newdst.in6 = loopback_addr; }else { +unsigned int scope =ipv6_addr_scope (&ipv6_hdr (skb)->daddr);struct inet6_dev *idev; -struct inet6_ifaddr *ifa;bool addr = false; idev =__in6_dev_get (skb->dev);if (idev !=NULL ) { +const struct inet6_ifaddr *ifa; +read_lock_bh (&idev->lock);list_for_each_entry (ifa, &idev->addr_list, if_list) { +if (!nf_nat_redirect_ipv6_usable (ifa, scope)) +continue ; + newdst.in6 = ifa->addr; addr = true;break ;
Signature · 1 line
2.30.2