VirtualBox

Changeset 40583 in vbox


Ignore:
Timestamp:
Mar 23, 2012 4:20:59 AM (13 years ago)
Author:
vboxsync
Message:

NAT: verification that sockets always stay on right queues.

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

Legend:

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

    r40423 r40583  
    798798        NSOCK_INC_EX(la);
    799799        if (link_type == LINK_TCP)
     800        {
     801            so->so_type = IPPROTO_TCP;
    800802            insque(la->pData, so, &la->tcb);
     803        }
    801804        else if (link_type == LINK_UDP)
     805        {
     806            so->so_type = IPPROTO_UDP;
    802807            insque(la->pData, so, &la->udb);
     808        }
    803809        else
     810        {
     811            /* socket wasn't added to queue */
     812            closesocket(so->s);
     813            RTMemFree(so);
    804814            Assert(!"Shouldn't be here");
     815            return 0;
     816        }
    805817        LogFunc(("bind called for socket: %R[natsock]\n", so));
    806818#else
  • trunk/src/VBox/Devices/Network/slirp/slirp.c

    r40423 r40583  
    926926    QSOCKET_FOREACH(so, so_next, tcp)
    927927    /* { */
     928        Assert(so->so_type == IPPROTO_TCP);
    928929#if !defined(RT_OS_WINDOWS)
    929930        so->so_poll_index = -1;
     
    10121013    /* { */
    10131014
     1015        Assert(so->so_type == IPPROTO_UDP);
    10141016        STAM_COUNTER_INC(&pData->StatUDP);
    10151017#if !defined(RT_OS_WINDOWS)
  • trunk/src/VBox/Devices/Network/slirp/tcp_subr.c

    r40423 r40583  
    227227
    228228    so->so_tcpcb = tp;
     229    so->so_type = IPPROTO_TCP;
    229230
    230231    return (tp);
     
    598599tcp_attach(PNATState pData, struct socket *so)
    599600{
     601    /* We're attaching already attached socket??? */
     602    Assert(so->so_type == 0);
    600603    if ((so->so_tcpcb = tcp_newtcpcb(pData, so)) == NULL)
    601604        return -1;
  • trunk/src/VBox/Devices/Network/slirp/udp.c

    r40283 r40583  
    271271    so->so_faddr = ip->ip_dst;   /* XXX */
    272272    so->so_fport = uh->uh_dport; /* XXX */
     273    Assert(so->so_type == IPPROTO_UDP);
    273274
    274275    /*
     
    346347    LogFlowFunc(("ENTER: so = %R[natsock], m = %p, saddr = %RTnaipv4, daddr = %RTnaipv4\n",
    347348                 so, m, saddr->sin_addr.s_addr, daddr->sin_addr.s_addr));
     349
     350    /* in case of built-in service so might be NULL */
     351    if (so) Assert(so->so_type == IPPROTO_UDP);
    348352
    349353    /*
     
    399403    struct socket *pSocketClone = NULL;
    400404#endif
     405    Assert(so->so_type == IPPROTO_UDP);
    401406    LogFlowFunc(("ENTER: so = %R[natsock], m = %p, saddr = %RTnaipv4\n",
    402407                 so, (long)m, addr->sin_addr.s_addr));
     
    456461    int opt = 1;
    457462
     463    /* We attaching some olready attched socket ??? */
     464    Assert(so->so_type == 0);
    458465    if ((so->s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
    459466        goto error;
     
    497504    NSOCK_INC();
    498505    QSOCKET_UNLOCK(udb);
     506    so->so_type = IPPROTO_UDP;
    499507    return so->s;
    500508error:
     
    508516    if (so != &pData->icmp_socket)
    509517    {
     518        Assert(so->so_type == IPPROTO_UDP);
    510519        QSOCKET_LOCK(udb);
    511520        SOCKET_LOCK(so);
     
    552561    }
    553562    so->so_expire = curtime + SO_EXPIRE;
     563    so->so_type = IPPROTO_UDP;
    554564    fd_nonblock(so->s);
    555565    SOCKET_LOCK_CREATE(so);
     
    582592     * if statement was always true (INADDR_ANY=0). */
    583593    /* if (addr.sin_addr.s_addr == 0 || addr.sin_addr.s_addr == loopback_addr.s_addr) */
     594    /* @todo: vvl - alias_addr should be set (if required)
     595     * later by liabalias module.
     596     */
    584597    if (1 == 0)                 /* always use the else part */
    585598        so->so_faddr = alias_addr;
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