lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 23 Dec 2010 09:24:31 +0100
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Jiri Kosina <jkosina@...e.cz>
Cc:	David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org, Vojtech Pavlik <vojtech@...e.cz>,
	Ilpo Järvinen <ilpo.jarvinen@...sinki.fi>
Subject: Re: [PATCH] tcp: cleanup of cwnd initialization in
 tcp_init_metrics()

Le mercredi 22 décembre 2010 à 19:39 +0100, Jiri Kosina a écrit :
> Commit 86bcebafc5e7f5 ("tcp: fix >2 iw selection") fixed a case when 
> congestion window initialization has been mistakenly omitted by 
> introducing cwnd label and putting backwards jump from the end of the 
> function.
> 
> This makes the code unnecessarily tricky to read and understand on a first 
> sight.
> 
> Shuffle the code around a little bit to make it more obvious.

Well in fine you have

	if (inet_csk(sk)->icsk_rto < TCP_TIMEOUT_INIT && !tp->rx_opt.saw_tstamp)
		goto reset;
	goto out;
reset:

Is that really more obvious ? ;)

> 
> Signed-off-by: Jiri Kosina <jkosina@...e.cz>
> ---
>  net/ipv4/tcp_input.c |   10 ++++------
>  1 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index 6d8ab1c..dddff6d 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -915,11 +915,7 @@ static void tcp_init_metrics(struct sock *sk)
>  	if (inet_csk(sk)->icsk_rto < TCP_TIMEOUT_INIT && !tp->rx_opt.saw_tstamp)
>  		goto reset;
>  
> -cwnd:
> -	tp->snd_cwnd = tcp_init_cwnd(tp, dst);
> -	tp->snd_cwnd_stamp = tcp_time_stamp;
> -	return;
> -
> +	goto out;
>  reset:
>  	/* Play conservative. If timestamps are not
>  	 * supported, TCP will fail to recalculate correct
> @@ -930,7 +926,9 @@ reset:
>  		tp->mdev = tp->mdev_max = tp->rttvar = TCP_TIMEOUT_INIT;
>  		inet_csk(sk)->icsk_rto = TCP_TIMEOUT_INIT;
>  	}
> -	goto cwnd;
> +out:
> +	tp->snd_cwnd = tcp_init_cwnd(tp, dst);
> +	tp->snd_cwnd_stamp = tcp_time_stamp;
>  }
>  
>  static void tcp_update_reordering(struct sock *sk, const int metric,




--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ