netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: alexey.kodanev@oracle.com
Cc: netdev@vger.kernel.org, fw@strlen.de, edumazet@google.com
Subject: Re: [PATCH 1/2] tcp: setup random timestamp offset when write_seq already set
Date: Mon, 20 Feb 2017 10:18:07 -0500 (EST)	[thread overview]
Message-ID: <20170220.101807.883027207624802826.davem@davemloft.net> (raw)
In-Reply-To: <1487379372-28199-1-git-send-email-alexey.kodanev@oracle.com>

From: Alexey Kodanev <alexey.kodanev@oracle.com>
Date: Sat, 18 Feb 2017 03:56:11 +0300

> @@ -232,12 +232,17 @@ 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))
> +	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);
> +	} else if (likely(!tp->repair)) {
> +		secure_tcp_sequence_number(inet->inet_saddr, inet->inet_daddr,
> +					   inet->inet_sport, usin->sin_port,
> +					   &tp->tsoffset);
> +	}

This would be so much easier to understand if it were coded as:

	if (!tp->repair) {
		seq = secure_tcp_sequence_number(...);
		if (!tp->write_seq)
			tp->write_seq = seq;
	}

  parent reply	other threads:[~2017-02-20 15:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-18  0:56 [PATCH 1/2] tcp: setup random timestamp offset when write_seq already set Alexey Kodanev
2017-02-18  0:56 ` [PATCH 2/2] tcp: account for ts offset only if tsecr not zero Alexey Kodanev
2017-02-18  9:19 ` [PATCH 1/2] tcp: setup random timestamp offset when write_seq already set Alexey Kodanev
2017-02-20 15:18 ` David Miller [this message]
2017-02-20 16:29   ` Alexey Kodanev

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=20170220.101807.883027207624802826.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=alexey.kodanev@oracle.com \
    --cc=edumazet@google.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 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).