diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2006-12-03 11:50:42 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2006-12-03 11:50:42 -0500 |
commit | 76d127779e51fbf67ad6793214369aa1fea90278 (patch) | |
tree | cc6cbeb3b7eb6c59b5e13bb12a74e0fc89988c78 /net/dccp | |
parent | 8a508ac26e72aa203677aa6a8464bd3ea44216a6 (diff) |
[DCCP]: Fix BUG in retransmission delay calculation
This bug resulted in ccid3_hc_tx_send_packet returning negative
delay values, which in turn triggered silently dequeueing packets in
dccp_write_xmit. As a result, only a few out of the submitted packets made
it at all onto the network. Occasionally, when dccp_wait_for_ccid was
involved, this also triggered a bug warning since ccid3_hc_tx_send_packet
returned a negative value (which in reality was a negative delay value).
The cause for this bug lies in the comparison
if (delay >= hctx->ccid3hctx_delta)
return delay / 1000L;
The type of `delay' is `long', that of ccid3hctx_delta is `u32'. When comparing
negative long values against u32 values, the test returned `true' whenever delay
was smaller than 0 (meaning the packet was overdue to send).
The fix is by casting, subtracting, and then testing the difference with
regard to 0.
This has been tested and shown to work.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/dccp')
-rw-r--r-- | net/dccp/ccids/ccid3.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index 99807783a22f..22a07248c240 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -339,7 +339,7 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb) | |||
339 | * else | 339 | * else |
340 | * // send the packet in (t_nom - t_now) milliseconds. | 340 | * // send the packet in (t_nom - t_now) milliseconds. |
341 | */ | 341 | */ |
342 | if (delay >= hctx->ccid3hctx_delta) | 342 | if (delay - (long)hctx->ccid3hctx_delta >= 0) |
343 | return delay / 1000L; | 343 | return delay / 1000L; |
344 | break; | 344 | break; |
345 | case TFRC_SSTATE_TERM: | 345 | case TFRC_SSTATE_TERM: |