Welcome to the Linux Foundation Forum!

Linux Kernel tcp flow tcp_validate_incoming and RFC793

RFC 793, page 69 state that:

first check sequence number

  1. SYN-RECEIVED STATE
  2. ESTABLISHED STATE
  3. FIN-WAIT-1 STATE
  4. FIN-WAIT-2 STATE
  5. CLOSE-WAIT STATE
  6. CLOSING STATE
  7. LAST-ACK STATE
  8. TIME-WAIT STATE
  9.  
  10. Segments are processed in sequence. Initial tests on arrival
  11. are used to discard old duplicates, but further processing is
  12. done in SEG.SEQ order. If a segment's contents straddle the
  13. boundary between old and new, only the new parts should be
  14. processed.
  15.  
  16. There are four cases for the acceptability test for an incoming
  17. segment:
  18.  
  19. Segment Receive Test
  20. Length Window
  21. ------- ------- -------------------------------------------
  22.  
  23. 0 0 SEG.SEQ = RCV.NXT
  24.  
  25. 0 >0 RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND
  26.  
  27. >0 0 not acceptable
  28.  
  29. >0 >0 RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND
  30. or RCV.NXT =< SEG.SEQ+SEG.LEN-1 < RCV.NXT+RCV.WND
  31.  
  32. If the RCV.WND is zero, no segments will be acceptable, but
  33. special allowance should be made to accept valid ACKs, URGs and
  34. RSTs.
  35.  
  36. If an incoming segment is not acceptable, an acknowledgment
  37. should be sent in reply (unless the RST bit is set, if so drop
  38. the segment and return):
  39.  
  40. <SEQ=SND.NXT><ACK=RCV.NXT><CTL=ACK>
  41.  
  42. After sending the acknowledgment, drop the unacceptable segment
  43. and return.

If I am not wrong the equivalent code can be found inside tcp_validate_incoming(...):

  1. /* Step 1: check sequence number */
  2. if (!tcp_sequence(tp, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq)) {
  3. /* RFC793, page 37: "In all states except SYN-SENT, all reset
  4. * (RST) segments are validated by checking their SEQ-fields."
  5. * And page 69: "If an incoming segment is not acceptable,
  6. * an acknowledgment should be sent in reply (unless the RST
  7. * bit is set, if so drop the segment and return)".
  8. */
  9. if (!th->rst) {
  10. if (th->syn)
  11. goto syn_challenge;
  12. if (!tcp_oow_rate_limited(sock_net(sk), skb,
  13. LINUX_MIB_TCPACKSKIPPEDSEQ,
  14. &tp->last_oow_ack_time))
  15. tcp_send_dupack(sk, skb);
  16. } else if (tcp_reset_check(sk, skb)) {
  17. tcp_reset(sk);
  18. }
  19. goto discard;
  20. }

However my question is with the following line in the RFC:

  1. If the RCV.WND is zero, no segments will be acceptable, but
  2. special allowance should be made to accept ***valid ACKs***, ***URGs*** and
  3. RSTs.

I can see that RSTs has been taken care of, in the if() statement, however I can't seems to figured out which part of the code process valid ACKs and URGs.

Any help is greatly appreciated !!

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training