SNMPv2 tcpOutSegs counter error
Subsystems (3)
PATCH 1/1 SNMPv2 tcpOutSegs counter error
RFC2012 saied that tcpOutSegs should excluding those containing only retransmitted octets. But in my test, linux kernel increased the tcpOutSegs even if only retransmitted octets is send out. So I think this is a bug of kernel.
Refer to RFC2012, tcpOutSegs is defined as following:
tcpOutSegs OBJECT-TYPE
SYNTAX Counter32
MAX-ACCESS read-only
STATUS current DESCRIPTION
"The total number of segments sent, including those on current connections but excluding those containing only retransmitted octets."
::= { tcp 11 }
Following is my patch:
net/ipv4/tcp_output.c +2 -1
@@ -462,7 +462,8 @@ static int tcp_transmit_skb(struct sockif (skb->len != tcp_header_size)tcp_event_data_sent (tp, skb, sk); -TCP_INC_STATS (TCP_MIB_OUTSEGS ); +if (!(tcb->sacked &TCPCB_LOST )) +TCP_INC_STATS (TCP_MIB_OUTSEGS ); err = icsk->icsk_af_ops->queue_xmit (skb,0 );if (likely (err <=0 ))
David Miller
maintainerFrom: Wei Yongjun <[email protected]>
Date: Thu, 06 Jul 2006 04:01:18 -0400
net/ipv4/tcp_output.c static int tcp_transmit_skb(struct sock · line 466
Quoted 3 lines
net/ipv4/tcp_output.c +2
-1-TCP_INC_STATS (TCP_MIB_OUTSEGS ); +if (!(tcb->sacked &TCPCB_LOST )) +TCP_INC_STATS (TCP_MIB_OUTSEGS );
This test is not accurate enough. For example, timer based retransmits will not set the TCPCB_LOST bit.
I'm tempted to say to pass a flag to tcp_transmit_skb() which says whether it is a retransmit or not, but that function already takes way too many arguments.