VirtualBox

Changeset 51904 in vbox for trunk/src


Ignore:
Timestamp:
Jul 7, 2014 2:09:10 PM (11 years ago)
Author:
vboxsync
Message:

NAT: Fix unsigned wraparound when calculating offered window. rcv_nxt
may "overtake" rcv_adv on successful window probe from guest.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/tcp_output.c

    r44528 r51904  
    234234         * TCP_MAXWIN << tp->rcv_scale.
    235235         */
    236         long adv = min(win,
    237                        (long)TCP_MAXWIN << tp->rcv_scale) -
    238                        (tp->rcv_adv - tp->rcv_nxt);
     236        long adv = min(win, (long)TCP_MAXWIN << tp->rcv_scale);
     237        if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt))
     238            adv -= tp->rcv_adv - tp->rcv_nxt;
    239239
    240240        if (adv >= (long) (2 * tp->t_maxseg))
     
    555555    if (win > (long)TCP_MAXWIN << tp->rcv_scale)
    556556        win = (long)TCP_MAXWIN << tp->rcv_scale;
    557     if (win < (long)(tp->rcv_adv - tp->rcv_nxt))
    558         win = (long)(tp->rcv_adv - tp->rcv_nxt);
     557    if (win < (long)(int32_t)(tp->rcv_adv - tp->rcv_nxt))
     558        win = (long)(int32_t)(tp->rcv_adv - tp->rcv_nxt);
    559559    ti->ti_win = RT_H2N_U16((u_int16_t) (win>>tp->rcv_scale));
    560560
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette