From: Wei Yongjun <yjwei@nanjing-fnst.com>
To: netdev@vger.kernel.org
Subject: [PATCH] SNMPv2 tcpAttemptFails counter error
Date: Wed, 05 Jul 2006 05:19:54 -0400 [thread overview]
Message-ID: <1152091195.3866.4.camel@LINE> (raw)
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. Following is my patch:
Signed-off-by: Wei Yongjun <yjwei@nanjing-fnst.com>
--- a/net/ipv4/tcp_input.c 2006-06-30 13:37:38.000000000 -0400
+++ b/net/ipv4/tcp_input.c 2006-07-05 04:45:04.000000000 -0400
@@ -4089,6 +4089,7 @@ static int tcp_rcv_synsent_state_process
*/
if (th->rst) {
+ TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
tcp_reset(sk);
goto discard;
}
@@ -4377,6 +4378,8 @@ int tcp_rcv_state_process(struct sock *s
/* 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;
}
@@ -4390,6 +4393,8 @@ int tcp_rcv_state_process(struct sock *s
* 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;
--- a/net/ipv4/tcp_minisocks.c 2006-06-30 13:37:38.000000000 -0400
+++ b/net/ipv4/tcp_minisocks.c 2006-07-05 04:45:04.000000000 -0400
@@ -592,8 +592,10 @@ struct sock *tcp_check_req(struct sock *
/* 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.
next reply other threads:[~2006-07-05 9:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-05 9:19 Wei Yongjun [this message]
2006-07-24 21:22 ` [PATCH] SNMPv2 tcpAttemptFails counter error David Miller
-- strict thread matches above, loose matches on Subject: below --
2006-07-28 11:40 Wei Yongjun
2006-07-31 3:36 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1152091195.3866.4.camel@LINE \
--to=yjwei@nanjing-fnst.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).