Skip to contentSkip to conversation

Why network stack not reply RST

DISCUSSION zrpeng 2 participants 3 messages Dec 27, 2011 – Dec 29, 2011

Subsystems (2)
lore
Share & tools
lore

zrpeng

author
#0 lore raw

Hi:
Why network stack not reply RST?
I am doing test recently based on kernel 2.6.32. In my case:
1) The server application closed the established socket, the network stack
sent FIN to client. The socket status in kernel's network stack was TCP_FIN_WAIT1.
2) The client sent out a tcp packet with ACK bit set for the server's FIN,
the packet also took new data.
3) When the server received the packet, network stack entered "step 5" in
function "tcp_rcv_state_process".
4) Then came to 'case TCP_FIN_WAIT1:'
5) Then came to judgement
if (tp->linger2 < 0 ||

					    (TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq &&
					     after(TCP_SKB_CB(skb)->end_seq - th->fin, tp->rcv_nxt))) {

.....
}
6) Because the previous packet took data and ACK (for the FIN), it entered
the judgement. So, the socket is deleted in function 'tcp_done(sk)'.
7) No TCP message was sent back to client side from then on, and client
was left in LAST_ACK status.

My questions are:
1) Is this process correct? I think the server should sent RST to client,
is this correct?
2) What's the using of judgement
(TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq &&

					     after(TCP_SKB_CB(skb)->end_seq - th->fin, tp->rcv_nxt)

       The code exists from kernel 2.3.41 and 2.3.42. 

    Thank you very much!
    Best Regards.

    Peng Zhaoran from Linx-Info Tech.
    
    www.linx-info.com
#1 lore raw

Hi,
Are you sure your client did not called fork() ? If it has
subprocess, there may be such problems.

Quoted 41 lines · zrpeng

Hi:
   Why network stack not reply RST?
   I am doing test recently based on kernel 2.6.32. In my case:
   1) The server application closed the established socket, the network stack
sent FIN to client. The socket status in kernel's network stack was
TCP_FIN_WAIT1.
   2) The client sent out a tcp packet with ACK bit set for the server's FIN,
the packet also took new data.
   3) When the server received the packet, network stack entered "step 5" in
function "tcp_rcv_state_process".
   4) Then came to 'case TCP_FIN_WAIT1:'
   5) Then came to judgement
if (tp->linger2 < 0 ||
                                           (TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq && after(TCP_SKB_CB(skb)->end_seq - th->fin, tp->rcv_nxt))) {
.....
}
   6) Because the previous packet took data and ACK (for the FIN), it entered
the judgement. So, the socket is deleted in function 'tcp_done(sk)'.
   7) No TCP message was sent back to client side from then on, and client
was left in LAST_ACK status.

   My questions are:
   1) Is this process correct? I think the server should sent RST to client,
is this correct?
   2) What's the using of judgement
 (TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq && after(TCP_SKB_CB(skb)->end_seq - th->fin, tp->rcv_nxt)

      The code exists from kernel 2.3.41 and 2.3.42.

   Thank you very much!
   Best Regards.

   Peng Zhaoran from Linx-Info Tech.

   www.linx-info.com
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

author
#2 lore raw

Hi:
It is my error. After returned from the judgement, the network stack will
send RST according to return value.

Thank you very much! And Happy New Year!
Best Regards.

Peng Zhaoran from Linx-Info Tech.

www.linx-info.com

Quoted 47 lines · 在 Thursday 29 December 2011 11:04:10,Zhen-Hua Li 写道:

Hi,
Are you sure your client did not called fork() ? If it has
subprocess, there may be such problems.

Quoted 42 lines · zrpeng

Hi:
   Why network stack not reply RST?
   I am doing test recently based on kernel 2.6.32. In my case:
   1) The server application closed the established socket, the network stack sent FIN to client. The socket status in kernel's network stack was TCP_FIN_WAIT1.
   2) The client sent out a tcp packet with ACK bit set for the server's FIN, the packet also took new data.
   3) When the server received the packet, network stack entered "step 5" in function "tcp_rcv_state_process".
   4) Then came to 'case TCP_FIN_WAIT1:'
   5) Then came to judgement
if (tp->linger2 < 0 ||
                                           (TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq && after(TCP_SKB_CB(skb)->end_seq - th->fin, tp->rcv_nxt))) { .....
}
   6) Because the previous packet took data and ACK (for the FIN), it entered the judgement. So, the socket is deleted in function 'tcp_done(sk)'. 7) No TCP message was sent back to client side from then on, and client was left in LAST_ACK status.

   My questions are:
   1) Is this process correct? I think the server should sent RST to client, is this correct?
   2) What's the using of judgement (TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq &&

after(TCP_SKB_CB(skb)->end_seq - th->fin, tp->rcv_nxt)

      The code exists from kernel 2.3.41 and 2.3.42.

   Thank you very much!
   Best Regards.

   Peng Zhaoran from Linx-Info Tech.

   www.linx-info.com
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html