From: Alexey Kodanev <alexey.kodanev@oracle.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>,
netdev <netdev@vger.kernel.org>, Florian Westphal <fw@strlen.de>,
Eric Dumazet <edumazet@google.com>
Subject: Re: [PATCH v2 1/2] tcp: setup timestamp offset when write_seq already set
Date: Wed, 22 Feb 2017 17:31:47 +0300 [thread overview]
Message-ID: <1842438a-56da-a868-5bb4-309d8e25e144@oracle.com> (raw)
In-Reply-To: <1487769474.9415.44.camel@edumazet-glaptop3.roam.corp.google.com>
On 02/22/2017 04:17 PM, Eric Dumazet wrote:
> On Wed, 2017-02-22 at 13:23 +0300, Alexey Kodanev wrote:
>> ...
>>
>> diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
>> index fe9da4f..c5169b8 100644
>> --- a/net/ipv4/tcp_ipv4.c
>> +++ b/net/ipv4/tcp_ipv4.c
>> @@ -145,6 +145,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
>> struct flowi4 *fl4;
>> struct rtable *rt;
>> int err;
>> + u32 seq;
>> struct ip_options_rcu *inet_opt;
>>
>> if (addr_len < sizeof(struct sockaddr_in))
>> @@ -232,12 +233,15 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
>> sk->sk_gso_type = SKB_GSO_TCPV4;
>> sk_setup_caps(sk, &rt->dst);
>>
>> - if (!tp->write_seq && likely(!tp->repair))
>> - tp->write_seq = secure_tcp_sequence_number(inet->inet_saddr,
>> - inet->inet_daddr,
>> - inet->inet_sport,
>> - usin->sin_port,
>> - &tp->tsoffset);
>> + if (likely(!tp->repair)) {
>> + seq = secure_tcp_sequence_number(inet->inet_saddr,
>> + inet->inet_daddr,
>> + inet->inet_sport,
>> + usin->sin_port,
>> + &tp->tsoffset);
>> + if (!tp->write_seq)
>> + tp->write_seq = seq;
>> + }
>>
> Nice catch !
>
> secure_tcp_sequence_number() could be renamed, because it has two
> purposes really.
What about "secure_tcp_seq_and_tsoff(...)" ?
Also,
tcp_v4_init_sequence(...) -> tcp_v4_init_seq_and_tsoff(...)
tcp_v6_init_sequence(...) -> tcp_v6_init_seq_and_tsoff(...)
Thanks,
Alexey
next prev parent reply other threads:[~2017-02-22 14:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-22 10:23 [PATCH v2 1/2] tcp: setup timestamp offset when write_seq already set Alexey Kodanev
2017-02-22 10:23 ` [PATCH v2 2/2] tcp: account for ts offset only if tsecr not zero Alexey Kodanev
2017-02-22 13:32 ` Eric Dumazet
2017-02-22 21:34 ` David Miller
2017-02-22 13:17 ` [PATCH v2 1/2] tcp: setup timestamp offset when write_seq already set Eric Dumazet
2017-02-22 14:31 ` Alexey Kodanev [this message]
2017-02-22 21:33 ` David Miller
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=1842438a-56da-a868-5bb4-309d8e25e144@oracle.com \
--to=alexey.kodanev@oracle.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=fw@strlen.de \
--cc=netdev@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.