Netfilter fixes for net
Subsystems (4)
Pablo Neira Ayuso
maintainercover Netfilter fixes for net
Hi,
The following patchset contains Netfilter fixes for net:
1) Spurious warning when loading rules using the physdev match, from Todd Seidelmann.
2) Fix FTP conntrack helper debugging output, from Thomas Jarosch.
3) Restore per-netns nf_conntrack_{acct,helper,timeout} sysctl knobs, from Florian Westphal.
4) Clear skbuff timestamp from the flowtable datapath, also from Florian.
5) Fix incorrect byteorder of NFT_META_BRI_IIFVPROTO, from wenxu.
You can pull these changes from:
git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git
Thanks.
----------------------------------------------------------------
The following changes since commit f53a7ad189594a112167efaf17ea8d0242b5ac00:
r8152: Set memory to all 0xFFs on failed reg reads (2019-08-25 19:52:59 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git HEAD
for you to fetch changes up to daf1de9078792a4d60e36aa7ecf3aadca65277c2:
netfilter: nft_meta_bridge: Fix get NFT_META_BRI_IIFVPROTO in network byteorder (2019-08-30 02:49:04 +0200)
----------------------------------------------------------------
Florian Westphal (2):
netfilter: conntrack: make sysctls per-namespace again
netfilter: nf_flow_table: clear skb tstamp before xmit
Thomas Jarosch (1):
netfilter: nf_conntrack_ftp: Fix debug output
Todd Seidelmann (1):
netfilter: xt_physdev: Fix spurious error message in physdev_mt_check
wenxu (1):
netfilter: nft_meta_bridge: Fix get NFT_META_BRI_IIFVPROTO in network byteorder
net/bridge/netfilter/nft_meta_bridge.c | 2 +- net/netfilter/nf_conntrack_ftp.c | 2 +- net/netfilter/nf_conntrack_standalone.c | 5 +++++ net/netfilter/nf_flow_table_ip.c | 3 ++- net/netfilter/xt_physdev.c | 6 ++---- 5 files changed, 11 insertions(+), 7 deletions(-)
Pablo Neira Ayuso
maintainerPATCH 1/5 netfilter: xt_physdev: Fix spurious error message in physdev_mt_check
From: Todd Seidelmann <[email protected]>
Simplify the check in physdev_mt_check() to emit an error message only when passed an invalid chain (ie, NF_INET_LOCAL_OUT). This avoids cluttering up the log with errors against valid rules.
For large/heavily modified rulesets, current behavior can quickly overwhelm the ring buffer, because this function gets called on every change, regardless of the rule that was changed.
--- net/netfilter/xt_physdev.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
net/netfilter/xt_physdev.c +2 -4
@@ -101,11 +101,9 @@ static int physdev_mt_check(const struct xt_mtchk_param *par)if (info->bitmask & (XT_PHYSDEV_OP_OUT |XT_PHYSDEV_OP_ISOUT ) && (!(info->bitmask &XT_PHYSDEV_OP_BRIDGED ) || info->invert &XT_PHYSDEV_OP_BRIDGED ) && - par->hook_mask & ((1 <<NF_INET_LOCAL_OUT ) | - (1 <<NF_INET_FORWARD ) | (1 <<NF_INET_POST_ROUTING ))) { + par->hook_mask & (1 <<NF_INET_LOCAL_OUT )) {pr_info_ratelimited ("--physdev-out and --physdev-is-out only supported in the FORWARD and POSTROUTING chains with bridged traffic\n" ); -if (par->hook_mask & (1 <<NF_INET_LOCAL_OUT )) -return -EINVAL ; +return -EINVAL ; }if (!brnf_probed) {
Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerPATCH 2/5 netfilter: nf_conntrack_ftp: Fix debug output
In reply to Pablo Neira AyusoFrom: Thomas Jarosch <[email protected]>
The find_pattern() debug output was printing the 'skip' character. This can be a NULL-byte and messes up further pr_debug() output.
Output without the fix:
kernel: nf_conntrack_ftp: Pattern matches!
kernel: nf_conntrack_ftp: Skipped up to <7>nf_conntrack_ftp: find_pattern PORT': dlen = 8
kernel: nf_conntrack_ftp: find_pattern `EPRT': dlen = 8
Output with the fix:
kernel: nf_conntrack_ftp: Pattern matches!
kernel: nf_conntrack_ftp: Skipped up to 0x0 delimiter!
kernel: nf_conntrack_ftp: Match succeeded!
kernel: nf_conntrack_ftp: conntrack_ftp: match `172,17,0,100,200,207' (20 bytes at 4150681645)
kernel: nf_conntrack_ftp: find_pattern `PORT': dlen = 8
--- net/netfilter/nf_conntrack_ftp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_conntrack_ftp.c +1 -1
@@ -322,7 +322,7 @@ static int find_pattern(const char *data, size_t dlen, i++; } -pr_debug ("Skipped up to `%c'!\n" , skip); +pr_debug ("Skipped up to 0x%hhx delimiter!\n" , skip); *numoff = i; *numlen =getnum (data + i, dlen - i, cmd, term, numoff);
Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerPATCH 3/5 netfilter: conntrack: make sysctls per-namespace again
In reply to Pablo Neira AyusoFrom: Florian Westphal <[email protected]>
When I merged the extension sysctl tables with the main one I forgot to reset them on netns creation. They currently read/write init_net settings.
--- net/netfilter/nf_conntrack_standalone.c | 5 +++++ 1 file changed, 5 insertions(+)
net/netfilter/nf_conntrack_standalone.c +5 -0
@@ -1037,9 +1037,14 @@ static int nf_conntrack_standalone_init_sysctl(struct net *net) table[NF_SYSCTL_CT_COUNT ].data = &net->ct.count; table[NF_SYSCTL_CT_CHECKSUM ].data = &net->ct.sysctl_checksum; table[NF_SYSCTL_CT_LOG_INVALID ].data = &net->ct.sysctl_log_invalid; + table[NF_SYSCTL_CT_ACCT ].data = &net->ct.sysctl_acct; + table[NF_SYSCTL_CT_HELPER ].data = &net->ct.sysctl_auto_assign_helper;#ifdef CONFIG_NF_CONNTRACK_EVENTS table[NF_SYSCTL_CT_EVENTS ].data = &net->ct.sysctl_events;#endif +#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP + table[NF_SYSCTL_CT_TIMESTAMP ].data = &net->ct.sysctl_tstamp; +#endif table[NF_SYSCTL_CT_PROTO_TIMEOUT_GENERIC ].data = &nf_generic_pernet (net)->timeout; table[NF_SYSCTL_CT_PROTO_TIMEOUT_ICMP ].data = &nf_icmp_pernet (net)->timeout; table[NF_SYSCTL_CT_PROTO_TIMEOUT_ICMPV6 ].data = &nf_icmpv6_pernet (net)->timeout;
Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerPATCH 4/5 netfilter: nf_flow_table: clear skb tstamp before xmit
In reply to Pablo Neira AyusoFrom: Florian Westphal <[email protected]>
If 'fq' qdisc is used and a program has requested timestamps, skb->tstamp needs to be cleared, else fq will treat these as 'transmit time'.
--- net/netfilter/nf_flow_table_ip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/nf_flow_table_ip.c +2 -1
@@ -228,7 +228,6 @@ static unsigned int nf_flow_xmit_xfrm(struct sk_buff *skb, {skb_orphan (skb);skb_dst_set_noref (skb, dst); - skb->tstamp =0 ;dst_output (state->net, state->sk, skb);return NF_STOLEN ; }
@@ -284,6 +283,7 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb, flow->timeout = (u32 )jiffies +NF_FLOW_TIMEOUT ; iph =ip_hdr (skb);ip_decrease_ttl (iph); + skb->tstamp =0 ;if (unlikely (dst_xfrm (&rt->dst))) {memset (skb->cb,0 ,sizeof (struct inet_skb_parm ));
@@ -512,6 +512,7 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb, flow->timeout = (u32 )jiffies +NF_FLOW_TIMEOUT ; ip6h =ipv6_hdr (skb); ip6h->hop_limit--; + skb->tstamp =0 ;if (unlikely (dst_xfrm (&rt->dst))) {memset (skb->cb,0 ,sizeof (struct inet6_skb_parm ));
Signature · 1 line
2.11.0
Pablo Neira Ayuso
maintainerPATCH 5/5 netfilter: nft_meta_bridge: Fix get NFT_META_BRI_IIFVPROTO in network byteorder
In reply to Pablo Neira AyusoFrom: wenxu <[email protected]>
Get the vlan_proto of ingress bridge in network byteorder as userspace expects. Otherwise this is inconsistent with NFT_META_PROTOCOL.
--- net/bridge/netfilter/nft_meta_bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bridge/netfilter/nft_meta_bridge.c +1 -1
@@ -53,7 +53,7 @@ static void nft_meta_bridge_get_eval(const struct nft_expr *expr, goto err;br_vlan_get_proto (br_dev, &p_proto); -nft_reg_store16 (dest, p_proto); +nft_reg_store16 (dest,htons (p_proto));return ; }default :
Signature · 1 line
2.11.0
David Miller
maintainerFrom: Pablo Neira Ayuso <[email protected]>
Date: Fri, 30 Aug 2019 14:06:59 +0200
Quoted 5 lines
The following patchset contains Netfilter fixes for net:
1) Spurious warning when loading rules using the physdev match, from Todd Seidelmann.
Quoted 8 lines
2) Fix FTP conntrack helper debugging output, from Thomas Jarosch.
3) Restore per-netns nf_conntrack_{acct,helper,timeout} sysctl knobs, from Florian Westphal.
4) Clear skbuff timestamp from the flowtable datapath, also from Florian.
5) Fix incorrect byteorder of
NFT_META_BRI_IIFVPROTO, from wenxu.
Pulled, thanks.