Welcome to the Linux Foundation Forum!

Linux Kernel tcp flow tcp_validate_incoming and RFC793

Options

RFC 793, page 69 state that:

first check sequence number

  SYN-RECEIVED STATE
  ESTABLISHED STATE
  FIN-WAIT-1 STATE
  FIN-WAIT-2 STATE
  CLOSE-WAIT STATE
  CLOSING STATE
  LAST-ACK STATE
  TIME-WAIT STATE

    Segments are processed in sequence.  Initial tests on arrival
    are used to discard old duplicates, but further processing is
    done in SEG.SEQ order.  If a segment's contents straddle the
    boundary between old and new, only the new parts should be
    processed.

    There are four cases for the acceptability test for an incoming
    segment:

    Segment Receive  Test
    Length  Window
    ------- -------  -------------------------------------------

       0       0     SEG.SEQ = RCV.NXT

       0      >0     RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND

      >0       0     not acceptable

      >0      >0     RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND
                  or RCV.NXT =< SEG.SEQ+SEG.LEN-1 < RCV.NXT+RCV.WND

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

    If an incoming segment is not acceptable, an acknowledgment
    should be sent in reply (unless the RST bit is set, if so drop
    the segment and return):

      <SEQ=SND.NXT><ACK=RCV.NXT><CTL=ACK>

    After sending the acknowledgment, drop the unacceptable segment
    and return.

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

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

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

If the RCV.WND is zero, no segments will be acceptable, but
special allowance should be made to accept ***valid ACKs***, ***URGs*** and
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 !!

Categories

Upcoming Training