Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[TCP]: htcp - use measured rtt

Change HTCP to use measured RTT rather than smooth RTT.
Srtt is computed using the TCP receive timestamp
options, so it is vulnerable to hostile receivers. To avoid any problems
this might cause use the measured RTT instead.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Stephen Hemminger and committed by
David S. Miller
113bbbd8 e7d0c885

+4 -4
+4 -4
net/ipv4/tcp_htcp.c
··· 76 76 return max(tp->snd_cwnd, (tp->snd_ssthresh << 7) / ca->beta); 77 77 } 78 78 79 - static inline void measure_rtt(struct sock *sk) 79 + static inline void measure_rtt(struct sock *sk, u32 srtt) 80 80 { 81 81 const struct inet_connection_sock *icsk = inet_csk(sk); 82 82 const struct tcp_sock *tp = tcp_sk(sk); 83 83 struct htcp *ca = inet_csk_ca(sk); 84 - u32 srtt = tp->srtt >> 3; 85 84 86 85 /* keep track of minimum RTT seen so far, minRTT is zero at first */ 87 86 if (ca->minRTT > srtt || !ca->minRTT) ··· 106 107 107 108 if (icsk->icsk_ca_state == TCP_CA_Open) 108 109 ca->pkts_acked = pkts_acked; 110 + 111 + if (rtt > 0) 112 + measure_rtt(sk, usecs_to_jiffies(rtt)); 109 113 110 114 if (!use_bandwidth_switch) 111 115 return; ··· 239 237 if (tp->snd_cwnd <= tp->snd_ssthresh) 240 238 tcp_slow_start(tp); 241 239 else { 242 - measure_rtt(sk); 243 - 244 240 /* In dangerous area, increase slowly. 245 241 * In theory this is tp->snd_cwnd += alpha / tp->snd_cwnd 246 242 */