VirtualBox

Changeset 34034 in vbox for trunk


Ignore:
Timestamp:
Nov 12, 2010 5:14:26 PM (14 years ago)
Author:
vboxsync
Message:

NAT: use right mbuf lenght calculation.

File:
1 edited

Legend:

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

    r30363 r34034  
    338338    register struct udpiphdr *ui;
    339339    int error;
     340    int mlen = 0;
    340341
    341342    DEBUG_CALL("udp_output");
     
    350351    m->m_data -= sizeof(struct udpiphdr);
    351352    m->m_len += sizeof(struct udpiphdr);
     353    mlen = m_length(m, NULL);
    352354
    353355    /*
     
    358360    memset(ui->ui_x1, 0, 9);
    359361    ui->ui_pr = IPPROTO_UDP;
    360     ui->ui_len = RT_H2N_U16(m->m_len - sizeof(struct ip));
     362    ui->ui_len = RT_H2N_U16(mlen - sizeof(struct ip));
    361363    /* XXXXX Check for from-one-location sockets, or from-any-location sockets */
    362364    ui->ui_src = saddr->sin_addr;
     
    372374    if (udpcksum)
    373375    {
    374         if ((ui->ui_sum = cksum(m, /* sizeof (struct udpiphdr) + */ m->m_len)) == 0)
     376        if ((ui->ui_sum = cksum(m, /* sizeof (struct udpiphdr) + */ mlen)) == 0)
    375377            ui->ui_sum = 0xffff;
    376378    }
    377     ((struct ip *)ui)->ip_len = m->m_len;
     379    ((struct ip *)ui)->ip_len = mlen;
    378380    ((struct ip *)ui)->ip_ttl = ip_defttl;
    379381    ((struct ip *)ui)->ip_tos = iptos;
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