diff options
author | Wei Yongjun <yjwei@nanjing-fnst.com> | 2006-07-30 23:35:54 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-08-02 16:38:19 -0400 |
commit | 3687b1dc6fe83a500ba4d3235704594f6a111a2d (patch) | |
tree | d57932b49d53234ea5daf2f2cbe780a8c347a1ad | |
parent | 118075b3cdc90e0815362365f3fc64d672ace0d6 (diff) |
[TCP]: SNMPv2 tcpAttemptFails counter error
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 }
When I lookup into RFC793, I found that the state change should occured
under following condition:
1. SYN-SENT -> CLOSED
a) Received ACK,RST segment when SYN-SENT state.
2. SYN-RCVD -> CLOSED
b) Received SYN segment when SYN-RCVD state(came from LISTEN).
c) Received RST segment when SYN-RCVD state(came from SYN-SENT).
d) Received SYN segment when SYN-RCVD state(came from SYN-SENT).
3. SYN-RCVD -> LISTEN
e) Received RST segment when SYN-RCVD state(came from LISTEN).
In my test, those direct state transition can not be counted to
tcpAttemptFails.
Signed-off-by: Wei Yongjun <yjwei@nanjing-fnst.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/tcp.h | 3 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_minisocks.c | 4 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 2 |
4 files changed, 6 insertions, 5 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 0720bddff1e9..7a093d0aa0fe 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -914,6 +914,9 @@ static inline void tcp_set_state(struct sock *sk, int state) | |||
914 | 914 | ||
915 | static inline void tcp_done(struct sock *sk) | 915 | static inline void tcp_done(struct sock *sk) |
916 | { | 916 | { |
917 | if(sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV) | ||
918 | TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS); | ||
919 | |||
917 | tcp_set_state(sk, TCP_CLOSE); | 920 | tcp_set_state(sk, TCP_CLOSE); |
918 | tcp_clear_xmit_timers(sk); | 921 | tcp_clear_xmit_timers(sk); |
919 | 922 | ||
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index f6f39e814291..4b04c3edd4a9 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -438,7 +438,6 @@ void tcp_v4_err(struct sk_buff *skb, u32 info) | |||
438 | It can f.e. if SYNs crossed. | 438 | It can f.e. if SYNs crossed. |
439 | */ | 439 | */ |
440 | if (!sock_owned_by_user(sk)) { | 440 | if (!sock_owned_by_user(sk)) { |
441 | TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS); | ||
442 | sk->sk_err = err; | 441 | sk->sk_err = err; |
443 | 442 | ||
444 | sk->sk_error_report(sk); | 443 | sk->sk_error_report(sk); |
@@ -874,7 +873,6 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
874 | drop_and_free: | 873 | drop_and_free: |
875 | reqsk_free(req); | 874 | reqsk_free(req); |
876 | drop: | 875 | drop: |
877 | TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS); | ||
878 | return 0; | 876 | return 0; |
879 | } | 877 | } |
880 | 878 | ||
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 0ccb7cb22b15..624e2b2c7f53 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
@@ -589,8 +589,10 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb, | |||
589 | /* RFC793: "second check the RST bit" and | 589 | /* RFC793: "second check the RST bit" and |
590 | * "fourth, check the SYN bit" | 590 | * "fourth, check the SYN bit" |
591 | */ | 591 | */ |
592 | if (flg & (TCP_FLAG_RST|TCP_FLAG_SYN)) | 592 | if (flg & (TCP_FLAG_RST|TCP_FLAG_SYN)) { |
593 | TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS); | ||
593 | goto embryonic_reset; | 594 | goto embryonic_reset; |
595 | } | ||
594 | 596 | ||
595 | /* ACK sequence verified above, just make sure ACK is | 597 | /* ACK sequence verified above, just make sure ACK is |
596 | * set. If ACK not set, just silently drop the packet. | 598 | * set. If ACK not set, just silently drop the packet. |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index b76fd7fba5f5..b843a650be71 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -427,7 +427,6 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
427 | case TCP_SYN_RECV: /* Cannot happen. | 427 | case TCP_SYN_RECV: /* Cannot happen. |
428 | It can, it SYNs are crossed. --ANK */ | 428 | It can, it SYNs are crossed. --ANK */ |
429 | if (!sock_owned_by_user(sk)) { | 429 | if (!sock_owned_by_user(sk)) { |
430 | TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS); | ||
431 | sk->sk_err = err; | 430 | sk->sk_err = err; |
432 | sk->sk_error_report(sk); /* Wake people up to see the error (see connect in sock.c) */ | 431 | sk->sk_error_report(sk); /* Wake people up to see the error (see connect in sock.c) */ |
433 | 432 | ||
@@ -831,7 +830,6 @@ drop: | |||
831 | if (req) | 830 | if (req) |
832 | reqsk_free(req); | 831 | reqsk_free(req); |
833 | 832 | ||
834 | TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS); | ||
835 | return 0; /* don't send reset */ | 833 | return 0; /* don't send reset */ |
836 | } | 834 | } |
837 | 835 | ||