VirtualBox

Changeset 39555 in vbox


Ignore:
Timestamp:
Dec 8, 2011 5:52:20 AM (13 years ago)
Author:
vboxsync
Message:

NAT/service: registering port-forwarding without ether address of the guest.

File:
1 edited

Legend:

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

    r39498 r39555  
    17221722{
    17231723    struct port_forward_rule *rule, *tmp;
     1724    const uint8_t *pu8EthSource;
     1725    if (!h_source)
     1726        pu8EthSource = h_source;
    17241727
    17251728    /* check mac here */
     
    17411744
    17421745#ifdef VBOX_WITH_NAT_SERVICE
    1743         if (memcmp(rule->mac_address, h_source, ETH_ALEN) != 0)
    1744             continue; /*not right mac, @todo: it'd be better do the list port forwarding per mac */
    1745         guest_addr = find_guest_ip(pData, h_source);
    1746 #else
    1747 #if 0
    1748         if (memcmp(client_ethaddr, h_source, ETH_ALEN) != 0)
    1749             continue;
    1750 #endif
    1751         guest_addr = find_guest_ip(pData, h_source);
    1752 #endif
     1746        /**
     1747         * case when guest ip is INADDR_ANY shouldn't appear in NAT service
     1748         */
     1749        Assert((rule->guest_addr.s_addr != INADDR_ANY));
     1750        guest_addr = rule->guest_addr.s_addr;
     1751#else /* VBOX_WITH_NAT_SERVICE */
     1752        guest_addr = find_guest_ip(pData, pu8EthSource);
     1753#endif /* !VBOX_WITH_NAT_SERVICE */
    17531754        if (guest_addr == INADDR_ANY)
    17541755        {
     
    18351836{
    18361837    struct port_forward_rule *rule = NULL;
    1837     Assert(ethaddr);
    18381838    LIST_FOREACH(rule, &pData->port_forward_rule_head, list)
    18391839    {
     
    18561856    rule->guest_addr.s_addr = guest_addr.s_addr;
    18571857    rule->bind_ip.s_addr = host_addr.s_addr;
    1858     memcpy(rule->mac_address, ethaddr, ETH_ALEN);
     1858    if (ethaddr != NULL)
     1859        memcpy(rule->mac_address, ethaddr, ETH_ALEN);
    18591860    /* @todo add mac address */
    18601861    LIST_INSERT_HEAD(&pData->port_forward_rule_head, rule, list);
    18611862    pData->cRedirectionsStored++;
    18621863    /* activate port-forwarding if guest has already got assigned IP */
    1863     if (memcmp(ethaddr, zerro_ethaddr, ETH_ALEN))
     1864    if (   ethaddr
     1865        && memcmp(ethaddr, zerro_ethaddr, ETH_ALEN))
    18641866        activate_port_forwarding(pData, ethaddr);
    18651867    return 0;
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