VirtualBox

Changeset 30045 in vbox for trunk


Ignore:
Timestamp:
Jun 4, 2010 8:38:56 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
62400
Message:

NAT: BSD sbuf.

Location:
trunk/src/VBox/Devices
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Makefile.kmk

    r30016 r30045  
    854854        Network/DrvNAT.cpp \
    855855        Network/slirp/bootp.c \
    856         Network/slirp/debug.c \
     856        Network/slirp/debug.c \
    857857        Network/slirp/ip_icmp.c \
    858858        Network/slirp/ip_input.c \
    859859        Network/slirp/ip_output.c \
    860860        Network/slirp/misc.c \
    861         Network/slirp/sbuf.c \
     861    Network/slirp/sbuf.c \
    862862        Network/slirp/slirp.c \
    863863        Network/slirp/socket.c \
     
    871871        Network/slirp/dnsproxy/dnsproxy.c
    872872
     873ifdef VBOX_WITH_SLIRP_BSD_SBUF
     874VBOX_SLIRP_SOURCES += Network/slirp/bsd/kern/subr_sbuf.c
     875endif
     876
    873877VBOX_SLIRP_BSD_ARCH = $(subst x86,i386,$(KBUILD_TARGET_ARCH))
    874878VBOX_SLIRP_BSD_SOURCES += \
     
    893897define def_vbox_slirp_cflags
    894898  $(file)_DEFS += \
     899      $(if $(VBOX_WITH_SLIRP_BSD_SBUF),VBOX_WITH_SLIRP_BSD_SBUF,) \
    895900      $(if $(VBOX_WITH_SLIRP_MEMORY_CHECK),RTMEM_WRAP_TO_EF_APIS,) \
    896901      $(if $(VBOX_WITH_DEBUG_NAT_SOCKETS),VBOX_WITH_DEBUG_NAT_SOCKETS,) \
  • trunk/src/VBox/Devices/Network/slirp/bsd/kern/subr_sbuf.c

    r30018 r30045  
    2727 */
    2828
     29#ifndef VBOX
    2930#include <sys/cdefs.h>
    3031__FBSDID("$FreeBSD: src/sys/kern/subr_sbuf.c,v 1.30.8.1 2009/04/15 03:14:26 kensmith Exp $");
     
    5960#define min(x,y)                MIN(x,y)
    6061#endif /* _KERNEL */
     62#else /* VBOX */
     63# include <iprt/param.h>
     64# include <iprt/ctype.h>
     65# include <slirp.h>
     66# define SBMALLOC(size) RTMemAlloc((size))
     67# define SBFREE(buf) RTMemFree((buf))
     68#endif
    6169
    6270/*
     
    417425        do {
    418426                va_copy(ap_copy, ap);
     427#ifndef VBOX
    419428                len = vsnprintf(&s->s_buf[s->s_len], SBUF_FREESPACE(s) + 1,
    420429                    fmt, ap_copy);
     430#else
     431                len = RTStrPrintfV(&s->s_buf[s->s_len], SBUF_FREESPACE(s) + 1,
     432                    fmt, ap_copy);
     433#endif
    421434                va_end(ap_copy);
    422435        } while (len > SBUF_FREESPACE(s) &&
     
    492505                return (-1);
    493506
     507#ifndef VBOX
    494508        while (s->s_len && isspace(s->s_buf[s->s_len-1]))
    495509                --s->s_len;
     510#else
     511        while (s->s_len && RT_C_IS_SPACE(s->s_buf[s->s_len-1]))
     512                --s->s_len;
     513#endif
    496514
    497515        return (0);
  • trunk/src/VBox/Devices/Network/slirp/bsd/sys/sbuf.h

    r30018 r30045  
    3232#define _SYS_SBUF_H_
    3333
     34#ifndef VBOX
    3435#include <sys/_types.h>
     36#else
     37# include <iprt/types.h>
     38#endif
    3539
    3640/*
     
    6569int              sbuf_cat(struct sbuf *, const char *);
    6670int              sbuf_cpy(struct sbuf *, const char *);
     71#ifndef VBOX
    6772int              sbuf_printf(struct sbuf *, const char *, ...) __printflike(2, 3);
    6873int              sbuf_vprintf(struct sbuf *, const char *, __va_list) __printflike(2, 0);
     74#else
     75int              sbuf_printf(struct sbuf *, const char *, ...);
     76int              sbuf_vprintf(struct sbuf *, const char *, va_list);
     77#endif
    6978int              sbuf_putc(struct sbuf *, int);
    7079int              sbuf_trim(struct sbuf *);
  • trunk/src/VBox/Devices/Network/slirp/debug.c

    r30016 r30045  
    207207        lprint("%15s %5d %5d %5d\n",
    208208                inet_ntoa(so->so_faddr), RT_N2H_U16(so->so_fport),
    209                 so->so_rcv.sb_cc, so->so_snd.sb_cc);
     209                SBUF_LEN(&so->so_rcv), SBUF_LEN(&so->so_snd));
    210210    LOOP_LABEL(tcp, so, so_next);
    211211    }
     
    221221        lprint("%15s %5d %5d %5d\n",
    222222                inet_ntoa(so->so_faddr), RT_N2H_U16(so->so_fport),
    223                 so->so_rcv.sb_cc, so->so_snd.sb_cc);
     223                SBUF_LEN(&so->so_rcv), SBUF_LEN(&so->so_snd));
    224224    LOOP_LABEL(udp, so, so_next);
    225225    }
  • trunk/src/VBox/Devices/Network/slirp/sbuf.c

    r30016 r30045  
    2626
    2727#include <slirp.h>
     28#ifndef VBOX_WITH_SLIRP_BSD_SBUF
    2829
    2930/* Done as a macro in socket.h */
     
    269270    }
    270271}
    271 
     272#else /* VBOX_WITH_SLIRP_BSD_SBUF */
     273void
     274sbappend (PNATState pData, struct socket *so, struct mbuf *m)
     275{
     276    int ret = 0;
     277    int mlen = 0;
     278    caddr_t buf = NULL;
     279
     280    STAM_PROFILE_START(&pData->StatIOSBAppend_pf, a);
     281    DEBUG_CALL("sbappend");
     282    DEBUG_ARG("so = %lx", (long)so);
     283    DEBUG_ARG("m = %lx", (long)m);
     284    DEBUG_ARG("m->m_len = %d", m ? m->m_len : 0);
     285
     286    STAM_COUNTER_INC(&pData->StatIOSBAppend);
     287    mlen = m_length(m, NULL);
     288    if (mlen <= 0)
     289    {
     290        STAM_COUNTER_INC(&pData->StatIOSBAppend_zm);
     291        goto done;
     292    }
     293
     294    /*
     295     * We only write if there's nothing in the buffer,
     296     * ottherwise it'll arrive out of order, and hence corrupt
     297     */
     298    buf = RTMemAlloc(mlen);
     299    if (buf == NULL)
     300    {
     301        ret = 0;
     302        goto no_sent;
     303    }
     304    m_copydata(m, 0, mlen, buf);
     305
     306    /*
     307     * If there is urgent data, call sosendoob
     308     * if not all was sent, sowrite will take care of the rest
     309     * (The rest of this function is just an optimisation)
     310     */
     311    if (so->so_urgc)
     312    {
     313        sbuf_bcpy(&so->so_rcv, buf, mlen);
     314        RTMemFree(buf);
     315        m_free(pData, m);
     316        sosendoob(so);
     317        return;
     318    }
     319
     320    if(!sbuf_len(&so->so_rcv))
     321        ret = send(so->s, buf, mlen, 0);
     322no_sent:
     323
     324    if (ret <= 0)
     325    {
     326        STAM_COUNTER_INC(&pData->StatIOSBAppend_wf);
     327        /*
     328         * Nothing was written
     329         * It's possible that the socket has closed, but
     330         * we don't need to check because if it has closed,
     331         * it will be detected in the normal way by soread()
     332         */
     333        sbuf_bcpy(&so->so_rcv, buf, mlen);
     334        STAM_PROFILE_STOP(&pData->StatIOSBAppend_pf_wf, a);
     335        goto done;
     336    }
     337    else if (ret != mlen)
     338    {
     339        STAM_COUNTER_INC(&pData->StatIOSBAppend_wp);
     340        /*
     341         * Something was written, but not everything..
     342         * sbappendsb the rest
     343         */
     344        sbuf_bcpy(&so->so_rcv, &buf[ret + 1], mlen - ret);
     345        STAM_PROFILE_STOP(&pData->StatIOSBAppend_pf_wp, a);
     346        goto done;
     347    } /* else */
     348    /* Whatever happened, we free the mbuf */
     349    STAM_COUNTER_INC(&pData->StatIOSBAppend_wa);
     350    STAM_PROFILE_STOP(&pData->StatIOSBAppend_pf_wa, a);
     351done:
     352    RTMemFree(buf);
     353    m_free(pData, m);
     354}
     355#endif
  • trunk/src/VBox/Devices/Network/slirp/sbuf.h

    r28800 r30045  
    2828#define _SBUF_H_
    2929
    30 #define sbflush(sb) sbdrop((sb),(sb)->sb_cc)
    31 #define sbspace(sb) ((sb)->sb_datalen - (sb)->sb_cc)
     30#ifndef VBOX_WITH_SLIRP_BSD_SBUF
     31# define sbflush(sb) sbdrop((sb),(sb)->sb_cc)
     32# define sbspace(sb) ((sb)->sb_datalen - (sb)->sb_cc)
     33# define SBUF_LEN(sb) ((sb)->sb_cc)
     34# define SBUF_SIZE(sb) ((sb)->sb_datalen)
     35
    3236
    3337struct sbuf
     
    4852void sbappendsb (PNATState, struct sbuf *, struct mbuf *);
    4953void sbcopy (struct sbuf *, int, int, char *);
     54#else
     55void sbappend (PNATState, struct socket *, struct mbuf *);
     56# include "bsd/sys/sbuf.h"
     57# define SBUF_LEN(sb) (sbuf_len(sb))
     58/* XXX: @todo SBUF_SIZE is a hack both space and SIZE shouldn't be used out of subr_sbuf.c*/
     59# define SBUF_SIZE(sb) ((sb)->s_size)
     60/* see subr_sbuf.c to verify the formula */
     61# define sbspace(sb) (SBUF_SIZE(sb) - SBUF_LEN((sb)) - 1)
    5062#endif
     63#endif
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r30016 r30045  
    791791    WSACleanup();
    792792#endif
     793#ifndef VBOX_WITH_SLIRP_BSD_SBUF
    793794#ifdef LOG_ENABLED
    794795    Log(("\n"
     
    806807         "\n"));
    807808#endif
     809#endif
    808810    RTMemFree(pData);
    809811}
     
    938940         * we have something to send
    939941         */
    940         if (CONN_CANFSEND(so) && so->so_rcv.sb_cc)
     942        if (CONN_CANFSEND(so) && SBUF_LEN(&so->so_rcv))
    941943        {
    942944            STAM_COUNTER_INC(&pData->StatTCPHot);
     
    948950         * receive more, and we have room for it XXX /2 ?
    949951         */
    950         if (CONN_CANFRCV(so) && (so->so_snd.sb_cc < (so->so_snd.sb_datalen/2)))
     952        /* @todo: vvl - check which predicat here will be more useful here in rerm of new sbufs. */
     953        if (CONN_CANFRCV(so) && (SBUF_LEN(&so->so_snd) < (SBUF_SIZE(&so->so_snd)/2)))
    951954        {
    952955            STAM_COUNTER_INC(&pData->StatTCPHot);
  • trunk/src/VBox/Devices/Network/slirp/socket.c

    r30016 r30045  
    134134 * a read() of 0 (or less) means it's disconnected
    135135 */
     136#ifndef VBOX_WITH_SLIRP_BSD_SBUF
    136137int
    137138soread(PNATState pData, struct socket *so)
     
    311312    return nn;
    312313}
     314#else /* VBOX_WITH_SLIRP_BSD_SBUF */
     315int
     316soread(PNATState pData, struct socket *so)
     317{
     318    int n;
     319    char *buf;
     320    struct sbuf *sb = &so->so_snd;
     321    size_t len = sbspace(sb);
     322    int mss = so->so_tcpcb->t_maxseg;
     323
     324    STAM_PROFILE_START(&pData->StatIOread, a);
     325    STAM_COUNTER_RESET(&pData->StatIORead_in_1);
     326    STAM_COUNTER_RESET(&pData->StatIORead_in_2);
     327
     328    QSOCKET_LOCK(tcb);
     329    SOCKET_LOCK(so);
     330    QSOCKET_UNLOCK(tcb);
     331
     332    DEBUG_CALL("soread");
     333    DEBUG_ARG("so = %lx", (long)so);
     334
     335    if (len > mss)
     336        len -= len % mss;
     337    buf = RTMemAlloc(len);
     338    if (buf == NULL)
     339    {
     340        LogRel(("NAT: can't alloc enough memory\n"));
     341        return -1;
     342    }
     343   
     344    n = recv(so->s, buf, len, (so->so_tcpcb->t_force? MSG_OOB:0));
     345    if (n <= 0)
     346    {
     347        /*
     348         * Special case for WSAEnumNetworkEvents: If we receive 0 bytes that
     349         * _could_ mean that the connection is closed. But we will receive an
     350         * FD_CLOSE event later if the connection was _really_ closed. With
     351         * www.youtube.com I see this very often. Closing the socket too early
     352         * would be dangerous.
     353         */
     354        int status;
     355        unsigned long pending = 0;
     356        status = ioctlsocket(so->s, FIONREAD, &pending);
     357        if (status < 0)
     358            LogRel(("NAT:error in WSAIoctl: %d\n", errno));
     359        if (n == 0 && (pending != 0))
     360        {
     361            SOCKET_UNLOCK(so);
     362            STAM_PROFILE_STOP(&pData->StatIOread, a);
     363            RTMemFree(buf);
     364            return 0;
     365        }
     366        if (   n < 0
     367            && (   errno == EINTR
     368                || errno == EAGAIN
     369                || errno == EWOULDBLOCK))
     370        {
     371            SOCKET_UNLOCK(so);
     372            STAM_PROFILE_STOP(&pData->StatIOread, a);
     373            RTMemFree(buf);
     374            return 0;
     375        }
     376        else
     377        {
     378            DEBUG_MISC((dfd, " --- soread() disconnected, n = %d, errno = %d-%s\n",
     379                        n, errno, strerror(errno)));
     380            sofcantrcvmore(so);
     381            tcp_sockclosed(pData, sototcpcb(so));
     382            SOCKET_UNLOCK(so);
     383            STAM_PROFILE_STOP(&pData->StatIOread, a);
     384            RTMemFree(buf);
     385            return -1;
     386        }
     387    }
     388
     389    sbuf_bcat(sb, buf, n);
     390    RTMemFree(buf);
     391    return n;
     392}
     393#endif
    313394
    314395/*
     
    337418     */
    338419    ret = soread(pData, so);
    339     tp->snd_up = tp->snd_una + so->so_snd.sb_cc;
     420    tp->snd_up = tp->snd_una + SBUF_LEN(&so->so_snd);
    340421    tp->t_force = 1;
    341422    tcp_output(pData, tp);
    342423    tp->t_force = 0;
    343424}
    344 
     425#ifndef VBOX_WITH_SLIRP_BSD_SBUF
    345426/*
    346427 * Send urgent data
     
    357438    DEBUG_CALL("sosendoob");
    358439    DEBUG_ARG("so = %lx", (long)so);
    359     DEBUG_ARG("sb->sb_cc = %d", sb->sb_cc);
    360440
    361441    if (so->so_urgc > sizeof(buff))
     
    558638    return nn;
    559639}
     640#else /* VBOX_WITH_SLIRP_BSD_SBUF */
     641static int
     642do_sosend(struct socket *so, int fUrg)
     643{
     644    struct sbuf *sb = &so->so_rcv;
     645
     646    int n, len;
     647
     648    DEBUG_CALL("sosendoob");
     649    DEBUG_ARG("so = %lx", (long)so);
     650
     651    len = sbuf_len(sb);
     652   
     653    n = send(so->s, sbuf_data(sb), len, (fUrg ? MSG_OOB : 0));
     654    if (n < 0)
     655    {
     656        LogRel(("NAT: Can't sent sbuf via socket.\n"));
     657    }
     658    if (fUrg)
     659        so->so_urgc -= n;
     660    if (n > 0 && n < len)
     661    {
     662        char *ptr;
     663        char *buff;
     664        buff = RTMemAlloc(len);
     665        if (buff == NULL)
     666        {
     667            LogRel(("NAT: No space to allocate temporal buffer\n"));
     668            return -1;
     669        }
     670        ptr = sbuf_data(sb);
     671        memcpy(buff, &ptr[n], len - n);
     672        sbuf_bcpy(sb, buff, len - n);
     673        RTMemFree(buff);
     674        return n;
     675    }
     676    sbuf_clear(sb);
     677    return n;
     678}
     679int
     680sosendoob(struct socket *so)
     681{
     682    return do_sosend(so, 1);
     683}
     684
     685/*
     686 * Write data from so_rcv to so's socket,
     687 * updating all sbuf field as necessary
     688 */
     689int
     690sowrite(PNATState pData, struct socket *so)
     691{
     692    return do_sosend(so, 1);
     693}
     694#endif
    560695
    561696/*
     
    9931128sofwdrain(struct socket *so)
    9941129{
    995     if (so->so_rcv.sb_cc)
     1130    if (SBUF_LEN(&so->so_rcv))
    9961131        so->so_state |= SS_FWDRAIN;
    9971132    else
  • trunk/src/VBox/Devices/Network/slirp/tcp_input.c

    r30016 r30045  
    511511        }
    512512        SOCKET_LOCK(so);
     513#ifndef VBOX_WITH_SLIRP_BSD_SBUF
    513514        sbreserve(pData, &so->so_snd, tcp_sndspace);
    514515        sbreserve(pData, &so->so_rcv, tcp_rcvspace);
     516#else
     517        sbuf_new(&so->so_snd, NULL, tcp_sndspace, SBUF_AUTOEXTEND);
     518        sbuf_new(&so->so_rcv, NULL, tcp_rcvspace, SBUF_AUTOEXTEND);
     519#endif
    515520
    516521/*      tcp_last_so = so; */  /* XXX ? */
     
    633638              tcpstat.tcps_rcvackpack++;
    634639              tcpstat.tcps_rcvackbyte += acked;
     640#ifndef VBOX_WITH_SLIRP_BSD_SBUF
    635641              sbdrop(&so->so_snd, acked);
     642#else
     643              if (sbuf_len(&so->so_snd) < acked)
     644                /* drop all what sbuf have */
     645                sbuf_setpos(&so->so_snd, 0);
     646              else
     647                sbuf_setpos(&so->so_snd, sbuf_len(&so->so_snd) - acked);
     648#endif
    636649              tp->snd_una = ti->ti_ack;
    637650              m_freem(pData, m);
     
    664677               * we don't need this.. XXX???
    665678               */
    666               if (so->so_snd.sb_cc)
     679              if (SBUF_LEN(&so->so_snd))
    667680                  (void) tcp_output(pData, tp);
    668681
     
    13241337                tp->snd_cwnd = min(cw + incr, TCP_MAXWIN<<tp->snd_scale);
    13251338            }
    1326             if (acked > so->so_snd.sb_cc)
    1327             {
    1328                 tp->snd_wnd -= so->so_snd.sb_cc;
     1339            if (acked > SBUF_LEN(&so->so_snd))
     1340            {
     1341                tp->snd_wnd -= SBUF_LEN(&so->so_snd);
     1342#ifndef VBOX_WITH_SLIRP_BSD_SBUF
    13291343                sbdrop(&so->so_snd, (int )so->so_snd.sb_cc);
     1344#else
     1345                sbuf_clear(&so->so_snd);
     1346#endif
    13301347                ourfinisacked = 1;
    13311348            }
    13321349            else
    13331350            {
     1351#ifndef VBOX_WITH_SLIRP_BSD_SBUF
    13341352                sbdrop(&so->so_snd, acked);
     1353#else
     1354                sbuf_setpos(&so->so_snd, sbuf_len(&so->so_snd) - acked);
     1355#endif
    13351356                tp->snd_wnd -= acked;
    13361357                ourfinisacked = 0;
     
    14461467            TCPS_HAVERCVDFIN(tp->t_state) == 0)
    14471468    {
     1469    /* BSD's sbufs are auto extent so we shouldn't worry here */
     1470#ifndef VBOX_WITH_SLIRP_BSD_SBUF
    14481471        /*
    14491472         * This is a kludge, but if we receive and accept
     
    14581481            goto dodata;
    14591482        }
     1483#endif
    14601484        /*
    14611485         * If this segment advances the known urgent pointer,
     
    14751499        {
    14761500            tp->rcv_up = ti->ti_seq + ti->ti_urp;
    1477             so->so_urgc =  so->so_rcv.sb_cc +
     1501            so->so_urgc =  SBUF_LEN(&so->so_rcv) +
    14781502                (tp->rcv_up - tp->rcv_nxt); /* -1; */
    14791503            tp->rcv_up = ti->ti_seq + ti->ti_urp;
     
    15391563         * buffer size.
    15401564         */
    1541         len = so->so_rcv.sb_datalen - (tp->rcv_adv - tp->rcv_nxt);
     1565        len = SBUF_SIZE(&so->so_rcv) - (tp->rcv_adv - tp->rcv_nxt);
    15421566    }
    15431567    else
     
    18911915    tp->snd_cwnd = mss;
    18921916
     1917#ifndef VBOX_WITH_SLIRP_BSD_SBUF
    18931918    sbreserve(pData, &so->so_snd, tcp_sndspace+((tcp_sndspace%mss)?(mss-(tcp_sndspace%mss)):0));
    18941919    sbreserve(pData, &so->so_rcv, tcp_rcvspace+((tcp_rcvspace%mss)?(mss-(tcp_rcvspace%mss)):0));
     1920#else
     1921    sbuf_new(&so->so_snd, NULL, tcp_sndspace+((tcp_sndspace%mss)?(mss-(tcp_sndspace%mss)):0), SBUF_AUTOEXTEND);
     1922    sbuf_new(&so->so_rcv, NULL, tcp_rcvspace+((tcp_rcvspace%mss)?(mss-(tcp_rcvspace%mss)):0), SBUF_AUTOEXTEND);
     1923#endif
    18951924
    18961925    DEBUG_MISC((dfd, " returning mss = %d\n", mss));
  • trunk/src/VBox/Devices/Network/slirp/tcp_output.c

    r30016 r30045  
    155155             * itself.
    156156             */
    157             if (off < so->so_snd.sb_cc)
     157            if (off < SBUF_LEN(&so->so_snd))
    158158                flags &= ~TH_FIN;
    159159            win = 1;
     
    166166    }
    167167
    168     len = min(so->so_snd.sb_cc, win) - off;
     168    len = min(SBUF_LEN(&so->so_snd), win) - off;
    169169    if (len < 0)
    170170    {
     
    191191        sendalot = 1;
    192192    }
    193     if (SEQ_LT(tp->snd_nxt + len, tp->snd_una + so->so_snd.sb_cc))
     193    if (SEQ_LT(tp->snd_nxt + len, tp->snd_una + SBUF_LEN(&so->so_snd)))
    194194        flags &= ~TH_FIN;
    195195
     
    211211            goto send;
    212212        if ((1 || idle || tp->t_flags & TF_NODELAY) &&
    213                 len + off >= so->so_snd.sb_cc)
     213                len + off >= SBUF_LEN(&so->so_snd))
    214214            goto send;
    215215        if (tp->t_force)
     
    241241        if (adv >= (long) (2 * tp->t_maxseg))
    242242            goto send;
    243         if (2 * adv >= (long) so->so_rcv.sb_datalen)
     243        if (2 * adv >= (long) SBUF_SIZE(&so->so_rcv))
    244244            goto send;
    245245    }
     
    285285     * otherwise force out a byte.
    286286     */
    287     if (   so->so_snd.sb_cc
     287    if (   SBUF_LEN(&so->so_snd)
    288288        && tp->t_timer[TCPT_REXMT] == 0
    289289        && tp->t_timer[TCPT_PERSIST] == 0)
     
    421421        {
    422422#endif
     423#ifndef VBOX_WITH_SLIRP_BSD_SBUF
    423424            sbcopy(&so->so_snd, off, (int) len, mtod(m, caddr_t) + hdrlen);
    424425            m->m_len += len;
     426#else
     427            m_copyback(pData, m, hdrlen, len, sbuf_data(&so->so_snd) + off);
     428#endif
    425429#if 0
    426430        }
     
    438442         * a PUSH comes in.)
    439443         */
    440         if (off + len == so->so_snd.sb_cc)
     444        if (off + len == SBUF_LEN(&so->so_snd))
    441445            flags |= TH_PUSH;
    442446    }
     
    525529     * but avoid silly window syndrome.
    526530     */
    527     if (win < (long)(so->so_rcv.sb_datalen / 4) && win < (long)tp->t_maxseg)
     531    if (win < (long)(SBUF_SIZE(&so->so_rcv) / 4) && win < (long)tp->t_maxseg)
    528532        win = 0;
    529533    if (win > (long)TCP_MAXWIN << tp->rcv_scale)
  • trunk/src/VBox/Devices/Network/slirp/tcp_subr.c

    r30016 r30045  
    306306    if (!(so->so_state & SS_FACCEPTCONN))
    307307    {
     308#ifndef VBOX_WITH_SLIRP_BSD_SBUF
    308309        sbfree(&so->so_rcv);
    309310        sbfree(&so->so_snd);
     311#else
     312        sbuf_delete(&so->so_rcv);
     313        sbuf_delete(&so->so_snd);
     314#endif
    310315    }
    311316    sofree(pData, so);
Note: See TracChangeset for help on using the changeset viewer.

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