Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3294f202 authored by Gerrit Renker's avatar Gerrit Renker
Browse files

dccp ccid-3: Bug-Fix - Zero RTT is possible



In commit $(825de27d) (from 27th May, commit
message `dccp ccid-3: Fix "t_ipi explosion" bug'), the CCID-3 window counter
computation was fixed to cope with RTTs < 4 microseconds.

Such RTTs can be found e.g. when running CCID-3 over loopback. The fix removed
a check against RTT < 4, but introduced a divide-by-zero bug.

All steady-state RTTs in DCCP are filtered using dccp_sample_rtt(), which
ensures non-zero samples. However, a zero RTT is possible on initialisation,
when there is no RTT sample from the Request/Response exchange.

The fix is to use the fallback-RTT from RFC 4340, 3.4.

This is also better than just fixing update_win_count() since it allows other
parts of the code to always assume that the RTT is non-zero during the time
that the CCID is used.

Signed-off-by: default avatarGerrit Renker <gerrit@erg.abdn.ac.uk>
parent 513fd370
Loading
Loading
Loading
Loading
+8 −2
Original line number Original line Diff line number Diff line
@@ -329,7 +329,13 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
			hctx->ccid3hctx_x    = rfc3390_initial_rate(sk);
			hctx->ccid3hctx_x    = rfc3390_initial_rate(sk);
			hctx->ccid3hctx_t_ld = now;
			hctx->ccid3hctx_t_ld = now;
		} else {
		} else {
			/* Sender does not have RTT sample: X_pps = 1 pkt/sec */
			/*
			 * Sender does not have RTT sample:
			 * - set fallback RTT (RFC 4340, 3.4) since a RTT value
			 *   is needed in several parts (e.g.  window counter);
			 * - set sending rate X_pps = 1pps as per RFC 3448, 4.2.
			 */
			hctx->ccid3hctx_rtt = DCCP_FALLBACK_RTT;
			hctx->ccid3hctx_x   = hctx->ccid3hctx_s;
			hctx->ccid3hctx_x   = hctx->ccid3hctx_s;
			hctx->ccid3hctx_x <<= 6;
			hctx->ccid3hctx_x <<= 6;
		}
		}