SNMPv2 tcpOutSegs counter error
Subsystems (3)
Patch has been fixed.
Quoted 4 lines · David Miller
From: Wei Yongjun <[email protected]>
Date: Fri, 04 Aug 2006 08:46:13 -0400Quoted 1 line
This always correct except when do active open in tcp client, which
will
Quoted 5 lines
Quoted 5 lines
send a SYN, that segment will not be counted, even if it is not restrained. Maybe I can do following to fix this:
Do you agree with me? If It is correctly, I will send this patch
soon.
Quoted 6 lines
This looks fine and should work.
Please add some comments in
tcp_connect()explaining the ordering of assignments, so that a future developer does not break things by accident.
net/ipv4/tcp_output.c +8 -3
@@ -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 (!before (tcb->seq, tp->snd_nxt)) +TCP_INC_STATS (TCP_MIB_OUTSEGS ); err = icsk->icsk_af_ops->queue_xmit (skb,0 );if (likely (err <=0 ))
@@ -2151,10 +2152,9 @@ int tcp_connect(struct sock *sk)skb_shinfo (buff)->tso_segs =1 ;skb_shinfo (buff)->tso_size =0 ; buff->csum =0 ; + tp->snd_nxt = tp->write_seq;TCP_SKB_CB (buff)->seq = tp->write_seq++;TCP_SKB_CB (buff)->end_seq = tp->write_seq; - tp->snd_nxt = tp->write_seq; - tp->pushed_seq = tp->write_seq;/* Send it off. */ TCP_SKB_CB (buff)->when = tcp_time_stamp;
@@ -2164,6 +2164,11 @@ int tcp_connect(struct sock *sk)sk_charge_skb (sk, buff); tp->packets_out +=tcp_skb_pcount (buff);tcp_transmit_skb (sk, buff,1 ,GFP_KERNEL ); +/* change tp->snd_nxt after tcp_transmit_skb() to make this packet to be +* counted to tcpOutSegs +*/ + tp->snd_nxt = tp->write_seq; + tp->pushed_seq = tp->write_seq;TCP_INC_STATS (TCP_MIB_ACTIVEOPENS );/* Timer for repeating the SYN until an answer. */
net/ipv4/tcp_output.c 2006-08-07 09:48:41.186372896 -0400 static int tcp_transmit_skb(struct sock · line 466
Quoted 10 lines · Wei Yongjun
net/ipv4/tcp_output.c 2006-08-07 09:48:41.186372896 -0400 renamed from net/ipv4/tcp_output.c 2006-08-03 18:05:22.425081936 -0400 +2
-1@@ -462,7 +462,8 @@ static int tcp_transmit_skb(struct sock if (skb->len != tcp_header_size) tcp_event_data_sent(tp, skb, sk); - TCP_INC_STATS(TCP_MIB_OUTSEGS); + if(!before(tcb->seq, tp->snd_nxt)) + TCP_INC_STATS(TCP_MIB_OUTSEGS);
The general approach looks sound. I have one esoteric question though. If a retransmitted packet is coalesced with one that is yet to be transmitted (a fairly unlikely scenario, but possible I think), should it count towards OUTSEGS?
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtDavid Miller
maintainerFrom: Herbert Xu <[email protected]>
Date: Mon, 07 Aug 2006 12:40:34 +1000
Quoted 4 lines
The general approach looks sound. I have one esoteric question though. If a retransmitted packet is coalesced with one that is yet to be transmitted (a fairly unlikely scenario, but possible I think), should it count towards OUTSEGS?
Probably the packet should be counted to OUTSEGS if any of it contains new data.
Quoted 10 lines · David Miller
From: Herbert Xu <[email protected]>
Date: Mon, 07 Aug 2006 12:40:34 +1000Quoted 4 lines
The general approach looks sound. I have one esoteric question though. If a retransmitted packet is coalesced with one that is yet to be transmitted (a fairly unlikely scenario, but possible I think), should it count towards OUTSEGS?
Probably the packet should be counted to OUTSEGS if any of it contains new data.
OK, in that case Yongjun please update your patch to test against tcb->end_seq instead of tcb->seq.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt