* [PATCH v1 net] tcp: Don't flag tcp_sk(sk)->rx_opt.saw_unknown for TCP AO.
@ 2024-07-03 3:35 Kuniyuki Iwashima
2024-07-03 6:14 ` Eric Dumazet
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Kuniyuki Iwashima @ 2024-07-03 3:35 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: David Ahern, Dmitry Safonov, Kuniyuki Iwashima, Kuniyuki Iwashima,
netdev
When we process segments with TCP AO, we don't check it in
tcp_parse_options(). Thus, opt_rx->saw_unknown is set to 1,
which unconditionally triggers the BPF TCP option parser.
Let's avoid the unnecessary BPF invocation.
Fixes: 0a3a809089eb ("net/tcp: Verify inbound TCP-AO signed segments")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
net/ipv4/tcp_input.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index e67cbeeeb95b..77294fd5fd3e 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4223,6 +4223,13 @@ void tcp_parse_options(const struct net *net,
* checked (see tcp_v{4,6}_rcv()).
*/
break;
+#endif
+#ifdef CONFIG_TCP_AO
+ case TCPOPT_AO:
+ /* TCP AO has already been checked
+ * (see tcp_inbound_ao_hash()).
+ */
+ break;
#endif
case TCPOPT_FASTOPEN:
tcp_parse_fastopen_option(
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1 net] tcp: Don't flag tcp_sk(sk)->rx_opt.saw_unknown for TCP AO.
2024-07-03 3:35 [PATCH v1 net] tcp: Don't flag tcp_sk(sk)->rx_opt.saw_unknown for TCP AO Kuniyuki Iwashima
@ 2024-07-03 6:14 ` Eric Dumazet
2024-07-03 17:16 ` Dmitry Safonov
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Eric Dumazet @ 2024-07-03 6:14 UTC (permalink / raw)
To: Kuniyuki Iwashima
Cc: David S. Miller, Jakub Kicinski, Paolo Abeni, David Ahern,
Dmitry Safonov, Kuniyuki Iwashima, netdev
On Wed, Jul 3, 2024 at 5:35 AM Kuniyuki Iwashima <kuniyu@amazon.com> wrote:
>
> When we process segments with TCP AO, we don't check it in
> tcp_parse_options(). Thus, opt_rx->saw_unknown is set to 1,
> which unconditionally triggers the BPF TCP option parser.
>
> Let's avoid the unnecessary BPF invocation.
>
> Fixes: 0a3a809089eb ("net/tcp: Verify inbound TCP-AO signed segments")
> Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 net] tcp: Don't flag tcp_sk(sk)->rx_opt.saw_unknown for TCP AO.
2024-07-03 3:35 [PATCH v1 net] tcp: Don't flag tcp_sk(sk)->rx_opt.saw_unknown for TCP AO Kuniyuki Iwashima
2024-07-03 6:14 ` Eric Dumazet
@ 2024-07-03 17:16 ` Dmitry Safonov
2024-07-04 10:05 ` Paolo Abeni
2024-07-04 10:30 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 6+ messages in thread
From: Dmitry Safonov @ 2024-07-03 17:16 UTC (permalink / raw)
To: Kuniyuki Iwashima
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
David Ahern, Kuniyuki Iwashima, netdev
On Wed, 3 Jul 2024 at 04:35, Kuniyuki Iwashima <kuniyu@amazon.com> wrote:
>
> When we process segments with TCP AO, we don't check it in
> tcp_parse_options(). Thus, opt_rx->saw_unknown is set to 1,
> which unconditionally triggers the BPF TCP option parser.
>
> Let's avoid the unnecessary BPF invocation.
>
> Fixes: 0a3a809089eb ("net/tcp: Verify inbound TCP-AO signed segments")
> Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
LGTM, thanks!
Acked-by: Dmitry Safonov <0x7f454c46@gmail.com>
--
Dmitry
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 net] tcp: Don't flag tcp_sk(sk)->rx_opt.saw_unknown for TCP AO.
2024-07-03 3:35 [PATCH v1 net] tcp: Don't flag tcp_sk(sk)->rx_opt.saw_unknown for TCP AO Kuniyuki Iwashima
2024-07-03 6:14 ` Eric Dumazet
2024-07-03 17:16 ` Dmitry Safonov
@ 2024-07-04 10:05 ` Paolo Abeni
2024-07-04 18:11 ` Kuniyuki Iwashima
2024-07-04 10:30 ` patchwork-bot+netdevbpf
3 siblings, 1 reply; 6+ messages in thread
From: Paolo Abeni @ 2024-07-04 10:05 UTC (permalink / raw)
To: Kuniyuki Iwashima, David S. Miller, Eric Dumazet, Jakub Kicinski
Cc: David Ahern, Dmitry Safonov, Kuniyuki Iwashima, netdev
On Tue, 2024-07-02 at 20:35 -0700, Kuniyuki Iwashima wrote:
> When we process segments with TCP AO, we don't check it in
> tcp_parse_options(). Thus, opt_rx->saw_unknown is set to 1,
> which unconditionally triggers the BPF TCP option parser.
>
> Let's avoid the unnecessary BPF invocation.
>
> Fixes: 0a3a809089eb ("net/tcp: Verify inbound TCP-AO signed segments")
> Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
> ---
> net/ipv4/tcp_input.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index e67cbeeeb95b..77294fd5fd3e 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -4223,6 +4223,13 @@ void tcp_parse_options(const struct net *net,
> * checked (see tcp_v{4,6}_rcv()).
> */
> break;
> +#endif
> +#ifdef CONFIG_TCP_AO
> + case TCPOPT_AO:
> + /* TCP AO has already been checked
> + * (see tcp_inbound_ao_hash()).
> + */
> + break;
> #endif
> case TCPOPT_FASTOPEN:
> tcp_parse_fastopen_option(
[not strictly related to this patch] possibly even MPTCP could benefit
from a similar change, but I'm unsure if we want to add even more cases
to this statement.
Cheers,
Paolo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 net] tcp: Don't flag tcp_sk(sk)->rx_opt.saw_unknown for TCP AO.
2024-07-03 3:35 [PATCH v1 net] tcp: Don't flag tcp_sk(sk)->rx_opt.saw_unknown for TCP AO Kuniyuki Iwashima
` (2 preceding siblings ...)
2024-07-04 10:05 ` Paolo Abeni
@ 2024-07-04 10:30 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-07-04 10:30 UTC (permalink / raw)
To: Kuniyuki Iwashima
Cc: davem, edumazet, kuba, pabeni, dsahern, 0x7f454c46, kuni1840,
netdev
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Tue, 2 Jul 2024 20:35:08 -0700 you wrote:
> When we process segments with TCP AO, we don't check it in
> tcp_parse_options(). Thus, opt_rx->saw_unknown is set to 1,
> which unconditionally triggers the BPF TCP option parser.
>
> Let's avoid the unnecessary BPF invocation.
>
> Fixes: 0a3a809089eb ("net/tcp: Verify inbound TCP-AO signed segments")
> Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
>
> [...]
Here is the summary with links:
- [v1,net] tcp: Don't flag tcp_sk(sk)->rx_opt.saw_unknown for TCP AO.
https://git.kernel.org/netdev/net/c/4b74726c01b7
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 net] tcp: Don't flag tcp_sk(sk)->rx_opt.saw_unknown for TCP AO.
2024-07-04 10:05 ` Paolo Abeni
@ 2024-07-04 18:11 ` Kuniyuki Iwashima
0 siblings, 0 replies; 6+ messages in thread
From: Kuniyuki Iwashima @ 2024-07-04 18:11 UTC (permalink / raw)
To: pabeni; +Cc: 0x7f454c46, davem, dsahern, edumazet, kuba, kuni1840, kuniyu,
netdev
From: Paolo Abeni <pabeni@redhat.com>
Date: Thu, 04 Jul 2024 12:05:42 +0200
> On Tue, 2024-07-02 at 20:35 -0700, Kuniyuki Iwashima wrote:
> > When we process segments with TCP AO, we don't check it in
> > tcp_parse_options(). Thus, opt_rx->saw_unknown is set to 1,
> > which unconditionally triggers the BPF TCP option parser.
> >
> > Let's avoid the unnecessary BPF invocation.
> >
> > Fixes: 0a3a809089eb ("net/tcp: Verify inbound TCP-AO signed segments")
> > Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
> > ---
> > net/ipv4/tcp_input.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> > index e67cbeeeb95b..77294fd5fd3e 100644
> > --- a/net/ipv4/tcp_input.c
> > +++ b/net/ipv4/tcp_input.c
> > @@ -4223,6 +4223,13 @@ void tcp_parse_options(const struct net *net,
> > * checked (see tcp_v{4,6}_rcv()).
> > */
> > break;
> > +#endif
> > +#ifdef CONFIG_TCP_AO
> > + case TCPOPT_AO:
> > + /* TCP AO has already been checked
> > + * (see tcp_inbound_ao_hash()).
> > + */
> > + break;
> > #endif
> > case TCPOPT_FASTOPEN:
> > tcp_parse_fastopen_option(
>
> [not strictly related to this patch] possibly even MPTCP could benefit
> from a similar change, but I'm unsure if we want to add even more cases
> to this statement.
Exactly, it seem no one has tried to inject/parse a new option with MPTCP.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-07-04 18:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-03 3:35 [PATCH v1 net] tcp: Don't flag tcp_sk(sk)->rx_opt.saw_unknown for TCP AO Kuniyuki Iwashima
2024-07-03 6:14 ` Eric Dumazet
2024-07-03 17:16 ` Dmitry Safonov
2024-07-04 10:05 ` Paolo Abeni
2024-07-04 18:11 ` Kuniyuki Iwashima
2024-07-04 10:30 ` patchwork-bot+netdevbpf
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).