VirtualBox

Changeset 36352 in vbox


Ignore:
Timestamp:
Mar 23, 2011 4:58:16 AM (14 years ago)
Author:
vboxsync
Message:

NAT: for gratuitous ARP processing pair ar_sip, ar_sha is used.
NAT now is reporting what pair is used for addressing for statically address assigned guests.
It's also prevent adding broadcast ethernet address as one of element of pair.

File:
1 edited

Legend:

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

    r36216 r36352  
    14561456                 * let's do an ARP cache update
    14571457                 */
    1458                 slirp_arp_cache_update_or_add(pData, *(uint32_t *)ah->ar_tip, &eh->h_dest[0]);
     1458                static bool fGratuitousArpReported;
     1459                if (!fGratuitousArpReported)
     1460                {
     1461                    LogRel(("NAT: Gratuitous ARP [IP:%R[IP4], ether:%R[ether]]\n",
     1462                            ah->ar_sip, ah->ar_sha));
     1463                    fGratuitousArpReported = true;
     1464                }
     1465                slirp_arp_cache_update_or_add(pData, *(uint32_t *)ah->ar_sip, &ah->ar_sha[0]);
    14591466            }
    14601467            break;
     
    19481955    LIST_FOREACH(ac, &pData->arp_cache, list)
    19491956    {
    1950         if (ac->ip == ip)
     1957        if (   ac->ip == ip
     1958            && memcmp(ac->ether, broadcast_ethaddr, ETH_ALEN) != 0)
    19511959        {
    19521960            memcpy(ether, ac->ether, ETH_ALEN);
     
    20272035{
    20282036    struct arp_cache_entry *ac;
     2037    if (!memcmp(mac, broadcast_ethaddr, ETH_ALEN))
     2038        return 1;
    20292039    LIST_FOREACH(ac, &pData->arp_cache, list)
    20302040    {
    2031         if (memcmp(ac->ether, mac, ETH_ALEN) == 0)
     2041        if (!memcmp(ac->ether, mac, ETH_ALEN))
    20322042        {
    20332043            ac->ip = dst;
     
    20482058    }
    20492059    ac->ip = ip;
     2060    if(!memcmp(ether, broadcast_ethaddr, ETH_ALEN))
     2061    {
     2062        static bool fBroadcastEtherAddReported;
     2063        if (!fBroadcastEtherAddReported)
     2064        {
     2065            LogRel(("NAT: Attept to add pair [%R[ether]:%R[IP4]] was ignored\n",
     2066                    ether, ip));
     2067            fBroadcastEtherAddReported = true;
     2068        }
     2069        RTMemFree(ac);
     2070        return;
     2071    }
    20502072    memcpy(ac->ether, ether, ETH_ALEN);
    20512073    LIST_INSERT_HEAD(&pData->arp_cache, ac, list);
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