VirtualBox

Changeset 30352 in vbox for trunk/src


Ignore:
Timestamp:
Jun 22, 2010 7:15:52 AM (15 years ago)
Author:
vboxsync
Message:

NAT: comments

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

Legend:

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

    r30016 r30352  
    206206        int mhlen, firstlen = len;
    207207        struct mbuf **mnext = &m->m_nextpkt;
    208         char *buf; /* intermediate buffer we'll use for copy from orriginal packet */
     208        char *buf; /* intermediate buffer we'll use for a copy of the original packet */
    209209        {
    210210            struct m_tag *t;
     
    218218            if (m->m_next != NULL)
    219219            {
    220                 /*we've receives packet in fragments*/
     220                /* we've receives packet in fragments */
    221221                tmplen = m_length(m, NULL);
    222222                tmpbuf = RTMemAlloc(tmplen);
     
    228228                tmpbuf = mtod(m, char *);
    229229                tmplen = m_length(m, NULL);
    230 
    231230            }
    232231
  • trunk/src/VBox/Devices/Network/slirp/udp.c

    r30350 r30352  
    161161
    162162#endif
    163             if(cksum(m, len + iphlen))
     163            if (cksum(m, len + iphlen))
    164164            {
    165165                udpstat.udps_badsum++;
    166166                Log3(("NAT: IP(id: %hd) has bad (udp) cksum\n", ip->ip_id));
    167                 goto bad;
     167                goto bad_free_mbuf;
    168168            }
    169169        }
     
    178178    {
    179179        bootp_input(pData, m);
    180         goto done;
     180        goto done_free_mbuf;
    181181    }
    182182
     
    191191        dst.sin_port = uh->uh_sport;
    192192
    193         /* udp_output2 expects pointer on the body of UDP packet. */
    194 
     193        /* udp_output2() expects a pointer to the body of UDP packet. */
    195194        m->m_data += sizeof(struct udpiphdr);
    196195        m->m_len -= sizeof(struct udpiphdr);
    197196        udp_output2(pData, NULL, m, &src, &dst, IPTOS_LOWDELAY);
    198         /* we shouldn't free this mbuf*/
    199197        return;
    200198    }
     
    206204    {
    207205        tftp_input(pData, m);
    208         goto done;
     206        goto done_free_mbuf;
    209207    }
    210208
     
    245243        {
    246244            Log2(("NAT: IP(id: %hd) failed to create socket\n", ip->ip_id));
    247             goto bad;
     245            goto bad_free_mbuf;
    248246        }
    249247        if (udp_attach(pData, so, 0) == -1)
     
    252250                        ip->ip_id, errno, strerror(errno)));
    253251            sofree(pData, so);
    254             goto bad;
     252            goto bad_free_mbuf;
    255253        }
    256254
     
    281279    {
    282280        dnsproxy_query(pData, so, m, iphlen);
    283         goto done;
     281        goto done_free_mbuf;
    284282    }
    285283
     
    314312    *ip = save_ip;
    315313    so->so_m = m;         /* ICMP backup */
    316 
    317314    return;
    318315
    319 bad:
     316bad_free_mbuf:
    320317    Log2(("NAT: UDP(id: %hd) datagram to %R[IP4] with size(%d) claimed as bad\n",
    321318        ip->ip_id, &ip->ip_dst, ip->ip_len));
    322 done:
     319
     320done_free_mbuf:
    323321    /* some services like bootp(built-in), dns(buildt-in) and dhcp don't need sockets
    324322     * and create new m'buffers to send them to guest, so we'll free their incomming
     
    329327}
    330328
     329/**
     330 * Output a UDP packet. This function will finally free the mbuf so
     331 * do NOT free any passed mbuf.
     332 */
    331333int udp_output2(PNATState pData, struct socket *so, struct mbuf *m,
    332334                struct sockaddr_in *saddr, struct sockaddr_in *daddr,
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