VirtualBox

Ignore:
Timestamp:
Nov 10, 2020 4:26:48 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
141292
Message:

slirp: bugref:9856 - in tcp_input() save optp and optlen in struct
socket for the re-entry on connect dance. Restore them on the second
entry because the options are only parsed at that time.

I'm not sure why - this is code from the original slirp - but nothing
in the options parsing code needs getting the "remote address" as the
comment claims. This bug is pretty corner case and has been
introduced in slirp changes to the BSD stack. Opt for the
conservative fix. The practical consequence is that we should now
respect the MSS that the guest advertises to us (ticketref:15256).

Location:
trunk/src/VBox/Devices/Network/slirp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/socket.h

    r82968 r86843  
    6060                                  * so_mconn, for non-blocking connections */
    6161    uint8_t         *so_ohdr;    /* unmolested IP header of the datagram in so_m */
     62    caddr_t         so_optp;     /* tcp options in so_m */
     63    int             so_optlen;   /* length of options in so_m */
    6264    int             so_urgc;
    6365    struct in_addr  so_faddr;    /* foreign host table entry */
  • trunk/src/VBox/Devices/Network/slirp/tcp_input.c

    r82968 r86843  
    324324        so = inso;
    325325        Log4(("NAT: tcp_input: %R[natsock]\n", so));
     326
    326327        /* Re-set a few variables */
    327328        tp = sototcpcb(so);
     329
    328330        m = so->so_m;
    329         so->so_m = 0;
     331        optp = so->so_optp;     /* points into m if set */
     332        optlen = so->so_optlen;
     333        so->so_m = NULL;
     334        so->so_optp = 0;
     335        so->so_optlen = 0;
    330336
    331337        if (RT_LIKELY(so->so_ohdr != NULL))
     
    826832                so->so_ti = ti;
    827833                so->so_ohdr = RTMemDup(ohdr, ohdrlen);
     834                so->so_optp = optp;
     835                so->so_optlen = optlen;
    828836                tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT;
    829837                TCP_STATE_SWITCH_TO(tp, TCPS_SYN_RECEIVED);
     
    20152023    int mss;
    20162024
    2017     LogFlowFunc(("ENTER: tcp_mss: tp = %R[tcpcb793], offer = %d\n", tp, offer));
     2025    LogFlowFunc(("ENTER: tcp_mss: offer=%u, t_maxseg=%u; tp=%R[natsock]\n",
     2026                 offer, (unsigned int)tp->t_maxseg, so));
    20182027
    20192028    mss = min(if_mtu, if_mru) - sizeof(struct tcpiphdr);
     
    20292038    sbreserve(pData, &so->so_rcv, tcp_rcvspace+((tcp_rcvspace%mss)?(mss-(tcp_rcvspace%mss)):0));
    20302039
    2031     Log2((" returning mss = %d\n", mss));
    2032 
     2040    LogFlowFunc(("LEAVE: mss=%d\n", mss));
    20332041    return mss;
    20342042}
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