[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+HUmGjYkiOmpMUA1JMeC7q4AX=xOo3B=AtTbQabJdbSJmaoQg@mail.gmail.com>
Date: Tue, 23 Aug 2022 15:40:18 -0700
From: Francesco Ruggeri <fruggeri@...sta.com>
To: Leonard Crestez <cdleonard@...il.com>
Cc: Dmitry Safonov <dima@...sta.com>,
Andy Lutomirski <luto@...capital.net>,
Ard Biesheuvel <ardb@...nel.org>,
Bob Gilligan <gilligan@...sta.com>,
David Ahern <dsahern@...nel.org>,
Dmitry Safonov <0x7f454c46@...il.com>,
Eric Biggers <ebiggers@...nel.org>,
Herbert Xu <herbert@...dor.apana.org.au>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Ivan Delalande <colona@...sta.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Salam Noureddine <noureddine@...sta.com>,
Shuah Khan <shuah@...nel.org>, netdev@...r.kernel.org,
linux-crypto@...r.kernel.org, Eric Dumazet <edumazet@...gle.com>,
"David S. Miller" <davem@...emloft.net>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 19/31] net/tcp: Add TCP-AO SNE support
On Tue, Aug 23, 2022 at 7:50 AM Leonard Crestez <cdleonard@...il.com> wrote:
>
> On 8/18/22 19:59, Dmitry Safonov wrote:
> > Add Sequence Number Extension (SNE) extension for TCP-AO.
> > This is needed to protect long-living TCP-AO connections from replaying
> > attacks after sequence number roll-over, see RFC5925 (6.2).
>
> > +#ifdef CONFIG_TCP_AO
> > + ao = rcu_dereference_protected(tp->ao_info,
> > + lockdep_sock_is_held((struct sock *)tp));
> > + if (ao) {
> > + if (ack < ao->snd_sne_seq)
> > + ao->snd_sne++;
> > + ao->snd_sne_seq = ack;
> > + }
> > +#endif
> > tp->snd_una = ack;
> > }
>
> ... snip ...
>
> > +#ifdef CONFIG_TCP_AO
> > + ao = rcu_dereference_protected(tp->ao_info,
> > + lockdep_sock_is_held((struct sock *)tp));
> > + if (ao) {
> > + if (seq < ao->rcv_sne_seq)
> > + ao->rcv_sne++;
> > + ao->rcv_sne_seq = seq;
> > + }
> > +#endif
> > WRITE_ONCE(tp->rcv_nxt, seq);
>
> It should always be the case that (rcv_nxt == rcv_sne_seq) and (snd_una
> == snd_sne_seq) so the _sne_seq fields are redundant. It's possible to
> avoid those extra fields.
There are cases where rcv_nxt and snd_una are set outside of
tcp_rcv_nxt_update() and tcp_snd_una_update(), mostly during the
initial handshake, so those cases would have to be taken care of
explicitly, especially wrt rollovers.
I see your point though, there may be a potential for some cleaning
up here.
Francesco
Powered by blists - more mailing lists