VirtualBox

Changeset 83580 in vbox for trunk/src


Ignore:
Timestamp:
Apr 6, 2020 1:15:02 AM (5 years ago)
Author:
vboxsync
Message:

NAT: bugref:9703 - checking for the value of a switch variable in a
case for a different value doesn't really work. While here, add a few
defensive checks/assertions.

File:
1 edited

Legend:

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

    r82968 r83580  
    388388static int dhcp_send_ack(PNATState pData, struct bootp_t *bp, BOOTPClient *bc, struct mbuf *m, int fDhcpRequest)
    389389{
     390    AssertReturn(bc != NULL, -1);
     391
    390392    int offReply = 0; /* boot_reply will fill general options and add END before sending response */
    391393
     
    571573            break;
    572574
     575        case REBINDING:
     576            LogRel(("NAT: REBINDING state isn't impemented\n"));
     577            return -1;
     578
     579        case SELECTING:
     580            LogRel(("NAT: SELECTING state isn't impemented\n"));
     581            return -1;
     582
    573583        case NONE:
    574             if (dhcp_stat == REBINDING)
    575                 LogRel(("NAT: REBINDING state isn't impemented\n"));
    576             else if (dhcp_stat == SELECTING)
    577                 LogRel(("NAT: SELECTING state isn't impemented\n"));
    578584            return -1;
    579585
     
    581587            break;
    582588    }
     589
     590    if (bc == NULL)
     591        return -1;
    583592
    584593    LogRel(("NAT: DHCP offered IP address %RTnaipv4\n", bc->addr.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