linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sk->state_chage is not called for listening sockets
@ 2001-04-13  6:51 Pete Zaitcev
  2001-04-19 20:51 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Pete Zaitcev @ 2001-04-13  6:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: zaitcev

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: sk->state_chage is not called for listening sockets
  2001-04-13  6:51 sk->state_chage is not called for listening sockets Pete Zaitcev
@ 2001-04-19 20:51 ` David S. Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2001-04-19 20:51 UTC (permalink / raw)
  To: Pete Zaitcev; +Cc: linux-kernel


Pete Zaitcev writes:
 > 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

I've applied this patch, thanks.

Later,
David S. Miller
davem@redhat.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-04-19 20:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-13  6:51 sk->state_chage is not called for listening sockets Pete Zaitcev
2001-04-19 20:51 ` David S. Miller

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