sk->state_chage is not called for listening sockets

Pete Zaitcev (zaitcev@redhat.com)
Fri, 13 Apr 2001 02:51:43 -0400


Hello:

Suppose for a moment, that I have an in-kernel daemon, listening
on a TCP socket, and that the said daemon is interested to
know when connection becomes established. To that end it
puts something into sk->state_change. However, when connection
is established, state_chenge is not called (in 2.4.3).

With that in mind, would the following chage have any ill effects?
It does not seem to break anything obvious, but I am worried about
a performance degradation for some retarded benchmark.

diff -u -U 4 linux-2.4.3/net/ipv4/tcp_input.c linux-2.4.3-nfs/net/ipv4/tcp_input.c
--- linux-2.4.3/net/ipv4/tcp_input.c Fri Feb 9 11:34:13 2001
+++ linux-2.4.3-nfs/net/ipv4/tcp_input.c Thu Apr 12 23:23:59 2001
@@ -3712,16 +3712,16 @@
if (acceptable) {
tp->copied_seq = tp->rcv_nxt;
mb();
tcp_set_state(sk, TCP_ESTABLISHED);
+ sk->state_change(sk);

/* Note, that this wakeup is only for marginal
* crossed SYN case. Passively open sockets
* are not waked up, because sk->sleep == NULL
* and sk->socket == NULL.
*/
if (sk->socket) {
- sk->state_change(sk);
sk_wake_async(sk,0,POLL_OUT);
}

tp->snd_una = TCP_SKB_CB(skb)->ack_seq;

Thanks,
-- Pete
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/