Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=113bbbd8d2da61b50417a1dd06d8e7c19047e54b
Commit:     113bbbd8d2da61b50417a1dd06d8e7c19047e54b
Parent:     e7d0c88586a66cf03e70750a8119d984fdedf2aa
Author:     Stephen Hemminger <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 25 23:50:28 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Tue Jul 31 02:27:59 2007 -0700

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/ipv4/tcp_htcp.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/tcp_htcp.c b/net/ipv4/tcp_htcp.c
index fa61663..b66556c 100644
--- a/net/ipv4/tcp_htcp.c
+++ b/net/ipv4/tcp_htcp.c
@@ -76,12 +76,11 @@ static u32 htcp_cwnd_undo(struct sock *sk)
        return max(tp->snd_cwnd, (tp->snd_ssthresh << 7) / ca->beta);
 }
 
-static inline void measure_rtt(struct sock *sk)
+static inline void measure_rtt(struct sock *sk, u32 srtt)
 {
        const struct inet_connection_sock *icsk = inet_csk(sk);
        const struct tcp_sock *tp = tcp_sk(sk);
        struct htcp *ca = inet_csk_ca(sk);
-       u32 srtt = tp->srtt >> 3;
 
        /* keep track of minimum RTT seen so far, minRTT is zero at first */
        if (ca->minRTT > srtt || !ca->minRTT)
@@ -108,6 +107,9 @@ static void measure_achieved_throughput(struct sock *sk, 
u32 pkts_acked, s32 rtt
        if (icsk->icsk_ca_state == TCP_CA_Open)
                ca->pkts_acked = pkts_acked;
 
+       if (rtt > 0)
+               measure_rtt(sk, usecs_to_jiffies(rtt));
+
        if (!use_bandwidth_switch)
                return;
 
@@ -237,8 +239,6 @@ static void htcp_cong_avoid(struct sock *sk, u32 ack,
        if (tp->snd_cwnd <= tp->snd_ssthresh)
                tcp_slow_start(tp);
        else {
-               measure_rtt(sk);
-
                /* In dangerous area, increase slowly.
                 * In theory this is tp->snd_cwnd += alpha / tp->snd_cwnd
                 */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to