From: Florian Westphal <fw@strlen.de>
To: <netdev@vger.kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
<netfilter-devel@vger.kernel.org>
Subject: [PATCH net-next 7/8] netfilter: conntrack: prefer tcp_error_log to pr_debug
Date: Tue, 10 Oct 2023 16:53:37 +0200 [thread overview]
Message-ID: <20231010145343.12551-8-fw@strlen.de> (raw)
In-Reply-To: <20231010145343.12551-1-fw@strlen.de>
pr_debug doesn't provide any information other than that a packet
did not match existing state but also was found to not create a new
connection.
Replaces this with tcp_error_log, which will also dump packets'
content so one can see if this is a stray FIN or RST.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/netfilter/nf_conntrack_proto_tcp.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index 4018acb1d674..e573be5afde7 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -835,7 +835,8 @@ static bool tcp_error(const struct tcphdr *th,
static noinline bool tcp_new(struct nf_conn *ct, const struct sk_buff *skb,
unsigned int dataoff,
- const struct tcphdr *th)
+ const struct tcphdr *th,
+ const struct nf_hook_state *state)
{
enum tcp_conntrack new_state;
struct net *net = nf_ct_net(ct);
@@ -846,7 +847,7 @@ static noinline bool tcp_new(struct nf_conn *ct, const struct sk_buff *skb,
/* Invalid: delete conntrack */
if (new_state >= TCP_CONNTRACK_MAX) {
- pr_debug("nf_ct_tcp: invalid new deleting.\n");
+ tcp_error_log(skb, state, "invalid new");
return false;
}
@@ -980,7 +981,7 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct,
if (tcp_error(th, skb, dataoff, state))
return -NF_ACCEPT;
- if (!nf_ct_is_confirmed(ct) && !tcp_new(ct, skb, dataoff, th))
+ if (!nf_ct_is_confirmed(ct) && !tcp_new(ct, skb, dataoff, th, state))
return -NF_ACCEPT;
spin_lock_bh(&ct->lock);
--
2.41.0
next prev parent reply other threads:[~2023-10-10 14:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-10 14:53 [PATCH net-next 0/8] netfilter updates for next Florian Westphal
2023-10-10 14:53 ` [PATCH net-next 1/8] netfilter: nf_tables: Always allocate nft_rule_dump_ctx Florian Westphal
2023-10-12 0:40 ` patchwork-bot+netdevbpf
2023-10-10 14:53 ` [PATCH net-next 2/8] netfilter: nf_tables: Drop pointless memset when dumping rules Florian Westphal
2023-10-10 14:53 ` [PATCH net-next 3/8] netfilter: nf_tables: Carry reset flag in nft_rule_dump_ctx Florian Westphal
2023-10-10 14:53 ` [PATCH net-next 4/8] netfilter: nf_tables: Carry s_idx " Florian Westphal
2023-10-10 14:53 ` [PATCH net-next 5/8] netfilter: nf_tables: Don't allocate nft_rule_dump_ctx Florian Westphal
2023-10-10 14:53 ` [PATCH net-next 6/8] netfilter: conntrack: simplify nf_conntrack_alter_reply Florian Westphal
2023-10-10 14:53 ` Florian Westphal [this message]
2023-10-10 14:53 ` [PATCH net-next 8/8] netfilter: cleanup struct nft_table Florian Westphal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231010145343.12551-8-fw@strlen.de \
--to=fw@strlen.de \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).