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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 24 Mar 2010 10:02:03 +0100
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	杨硕 <shanqn@...il.com>
Cc:	netdev@...r.kernel.org
Subject: Re: why not use the tcp_set_state() in inet_csk_listen_start()?

Le mercredi 24 mars 2010 à 16:13 +0800, 杨硕 a écrit :
> why use "sk->sk_state = TCP_LISTEN" rather than "tcp_set_state(sk, TCP_LISTEN)"?
> 
> TIA :)
> 
> int inet_csk_listen_start(struct sock *sk, const int nr_table_entries)
> {
> 	struct inet_sock *inet = inet_sk(sk);
> 	struct inet_connection_sock *icsk = inet_csk(sk);
> 	int rc = reqsk_queue_alloc(&icsk->icsk_accept_queue, nr_table_entries);
> 
> 	if (rc != 0)
> 		return rc;
> 
> 	sk->sk_max_ack_backlog = 0;
> 	sk->sk_ack_backlog = 0;
> 	inet_csk_delack_init(sk);
> 
> 	/* There is race window here: we announce ourselves listening,
> 	 * but this transition is still not validated by get_port().
> 	 * It is OK, because this socket enters to hash table only
> 	 * after validation is complete.
> 	 */
> 	sk->sk_state = TCP_LISTEN;

Because its not necessary ?

tcp_set_state() takes care of particular state transitions.

In case of inet_csk_listen_start(), old state is TCP_CLOSE, so there is
nothing special to do in tcp_set_state().



--
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