VirtualBox

Changeset 9109 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 26, 2008 9:46:30 AM (17 years ago)
Author:
vboxsync
Message:

fix crash in slirp code if the wrong IP was released from DHCP (#2893)

File:
1 edited

Legend:

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

    r8009 r9109  
    5656}
    5757
    58 static void release_addr(PNATState pData, struct in_addr *paddr)
    59 {
    60     int i;
     58static int release_addr(PNATState pData, struct in_addr *paddr)
     59{
     60    unsigned i;
    6161
    6262    i = ntohl(paddr->s_addr) - START_ADDR - ntohl(special_addr.s_addr);
    6363    if (i >= NB_ADDR)
    64         return;
     64        return 0;
    6565    memset(bootp_clients[i].macaddr, '\0', 6);
    6666    bootp_clients[i].allocated = 0;
     67    return 1;
    6768}
    6869
     
    151152
    152153    if (dhcp_msg_type == DHCPRELEASE) {
     154        int rc;
    153155        ipv4_addr = ntohl(bp->bp_ciaddr.s_addr);
    154         release_addr(pData, &bp->bp_ciaddr);
    155         LogRel(("NAT: DHCP released IP address %u.%u.%u.%u\n",
     156        rc = release_addr(pData, &bp->bp_ciaddr);
     157        LogRel(("NAT: %s %u.%u.%u.%u\n",
     158                rc ? "DHCP released IP address" : "Ignored DHCP release for IP address",
    156159                ipv4_addr >> 24, (ipv4_addr >> 16) & 0xff, (ipv4_addr >> 8) & 0xff, ipv4_addr & 0xff));
    157160        dprintf("released addr=%08x\n", ntohl(bp->bp_ciaddr.s_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