Refer to RFC2012, tcpAttemptFails is defined as following:
  tcpAttemptFails OBJECT-TYPE
      SYNTAX      Counter32
      MAX-ACCESS  read-only
      STATUS      current
      DESCRIPTION
              "The number of times TCP connections have made a direct
              transition to the CLOSED state from either the SYN-SENT
              state or the SYN-RCVD state, plus the number of times TCP
              connections have made a direct transition to the LISTEN
              state from the SYN-RCVD state."
      ::= { tcp 7 }

State changes of SYN-RCVD to CLOSED, SYN-SENT to CLOSED and SYN-RCVD to
LISTEN should be counted to TCP_MIB_ATTEMPTFAILS.

Following state changes does not be counted to TCP_MIB_ATTEMPTFAILS by
the kernel.

SYN-SENT state => CLOSED

        TCP A                                         TCP B
  
    1.  LISTEN                                        CLOSED
   
    2.     <-- <SEQ=Z><CTL=SYN>                  -->  SYN-SENT

    3.     --> SEQ=X><ACK=Z+1><CTL=RST>          -->  CLOSED

SYN-RECEIVED state(came from SYN-SENT state) => CLOSED

        TCP A                                         TCP B
  
    1.  LISTEN                                        CLOSED

    2.     <-- <SEQ=Z><CTL=SYN>                  -->  SYN-SENT

    3.     --> <SEQ=X><ACK=Z+1><CTL=SYN>              SYN-SENT

    4.     <-- <SEQ=Z+1><ACK=X+1><CTL=ACK>       -->  SYN-RECEIVED

    3.     --> <SEQ=X+1><ACK=Z+2><CTL=RST>       -->  CLOSED

SYN-RECEIVED state(came from SYN-SENT state) => CLOSED

        TCP A                                         TCP B
  
    1.  LISTEN                                        CLOSED

    2.     <-- <SEQ=Z><CTL=SYN>                  -->  SYN-SENT

    3.     --> <SEQ=X><ACK=Z+1><CTL=SYN>              SYN-SENT

    4.     <-- <SEQ=Z+1><ACK=X+1><CTL=ACK>       -->  SYN-RECEIVED

    3.     --> <SEQ=X+1><ACK=Z+2><CTL=SYN>       -->  CLOSED

SYN-RECEIVED state => LISTEN

        TCP A                                         TCP B
  
    1.  LISTEN                                        LISTEN
  
    2.       ... <SEQ=Z><CTL=SYN>                -->  SYN-RECEIVED
  
    3.  (??) <-- <SEQ=X><ACK=Z+1><CTL=SYN,ACK>   <--  SYN-RECEIVED
  
    4.       --> <SEQ=Z+1><CTL=RST>              -->  (return to
LISTEN!)
  
    5.  LISTEN                                        LISTEN

SYN-RECEIVED state => LISTEN

        TCP A                                         TCP B
  
    1.  LISTEN                                        LISTEN
  
    2.       ... <SEQ=Z><CTL=SYN>                -->  SYN-RECEIVED
  
    3.  (??) <-- <SEQ=X><ACK=Z+1><CTL=SYN,ACK>   <--  SYN-RECEIVED
  
    4.       --> <SEQ=Z+1><CTL=SYN>              -->  (return to
LISTEN!)
  
    5.  LISTEN                                        LISTEN

Patch to kernel 2.6.15.4 as following:

diff -Nur a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
--- a/net/ipv4/tcp_input.c      2006-02-23 09:20:24.659262056 +0900
+++ b/net/ipv4/tcp_input.c      2006-02-23 09:28:50.772321176 +0900
@@ -4003,6 +4003,7 @@
                 */
 
                if (th->rst) {
+                       TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
                        tcp_reset(sk);
                        goto discard;
                }
@@ -4290,6 +4291,8 @@
 
        /* step 2: check RST bit */
        if(th->rst) {
+               if(sk->sk_state == TCP_SYN_RECV)
+                       TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
                tcp_reset(sk);
                goto discard;
        }
@@ -4303,6 +4306,8 @@
         *      Check for a SYN in window.
         */
        if (th->syn && !before(TCP_SKB_CB(skb)->seq, tp->rcv_nxt)) {
+               if(sk->sk_state == TCP_SYN_RECV)
+                       TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
                NET_INC_STATS_BH(LINUX_MIB_TCPABORTONSYN);
                tcp_reset(sk);
                return 1;
diff -Nur a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
--- a/net/ipv4/tcp_minisocks.c  2006-02-23 09:20:24.660261904 +0900
+++ b/net/ipv4/tcp_minisocks.c  2006-02-23 09:26:07.432152656 +0900
@@ -591,8 +591,10 @@
                /* RFC793: "second check the RST bit" and
                 *         "fourth, check the SYN bit"
                 */
-               if (flg & (TCP_FLAG_RST|TCP_FLAG_SYN))
+               if (flg & (TCP_FLAG_RST|TCP_FLAG_SYN)) {
+                       TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
                        goto embryonic_reset;
+               }
 
                /* ACK sequence verified above, just make sure ACK is
                 * set.  If ACK not set, just silently drop the packet.


-
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

Reply via email to