VirtualBox

Changeset 11117 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Aug 4, 2008 5:39:07 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
34053
Message:

intnet: Fixed busted ARP snooping on packets comming from the VMs. When we're the sharing MAC address of the host interface, this *has* to work or we'll not find the ARP replies.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp

    r11074 r11117  
    980980     * has already checked those.
    981981     */
    982     unsigned cLeft = pCache->cEntries;
     982    int i = pCache->cEntries - 2;
    983983    uint8_t const *pbEntry = pCache->pbEntries + pCache->cbEntry;
    984     while (--cLeft > 1)
     984    while (i >= 1)
    985985    {
    986986        if (RT_LIKELY(intnetR0AddrUIsEqualEx((PCRTNETADDRU)pbEntry, pAddr, cbAddr)))
     
    990990        }
    991991        pbEntry += pCache->cbEntry;
    992         cLeft--;
     992        i--;
    993993    }
    994994
     
    10141014
    10151015    /*
    1016      * The optimized case is when the address the first cache entry.
     1016     * The optimized case is when the address the first or last cache entry.
    10171017     */
    10181018    unsigned i = pCache->cEntries;
    10191019    if (RT_LIKELY(   i > 0
    1020                   && intnetR0AddrUIsEqualEx((PCRTNETADDRU)pCache->pbEntries, pAddr, cbAddr)))
     1020                  && (   intnetR0AddrUIsEqualEx((PCRTNETADDRU)pCache->pbEntries, pAddr, cbAddr)
     1021                      || (i > 1
     1022                          && intnetR0AddrUIsEqualEx((PCRTNETADDRU)(pCache->pbEntries + pCache->cbEntry * i), pAddr, cbAddr))) ))
    10211023    {
    10221024        /** @todo usage/ageing? */
    10231025        return;
    10241026    }
    1025     if (i <= 1)
    1026         return;
    1027 
    1028     /*
    1029      * And the case where it's the last entry.
    1030      */
    1031     i--;
    1032     if (RT_LIKELY(intnetR0AddrUIsEqualEx((PCRTNETADDRU)pCache->pbEntries, pAddr, cbAddr)))
    1033     {
    1034         /** @todo usage/ageing? */
    1035         return;
    1036     }
    1037     if (i <= 1)
    1038         return;
    1039 
    10401027    intnetR0IfAddrCacheAddSlow(pIf, pCache, pAddr, cbAddr, pszMsg);
    10411028}
     
    22502237    {
    22512238        intnetR0SgInitTemp(&Sg, (void *)pvFrame, cbFrame);
     2239        if (pNetwork->fFlags & INTNET_OPEN_FLAGS_SHARED_MAC_ON_WIRE)
     2240            intnetR0IfSnoopAddr(pIf, (uint8_t *)pvFrame, cbFrame, (uint16_t *)&Sg.fFlags);
    22522241        intnetR0NetworkSend(pNetwork, pIf, 0, &Sg, !!pTrunkIf);
    22532242    }
     
    34723461                Assert(pTrunkIF->pIfPort);
    34733462                pNetwork->pTrunkIF = pTrunkIF;
    3474                 LogFlow(("intnetR0NetworkCreateTrunkIf: VINF_SUCCESS - pszName=%s szTrunk=%s Network=%s\n",
    3475                          rc, pszName, pNetwork->szTrunk, pNetwork->szName));
     3463                Log(("intnetR0NetworkCreateTrunkIf: VINF_SUCCESS - pszName=%s szTrunk=%s %s Network=%s%s\n",
     3464                     pszName, pNetwork->szTrunk, pNetwork->fFlags & INTNET_OPEN_FLAGS_SHARED_MAC_ON_WIRE ? " shared-mac" : "", pNetwork->szName));
    34763465                return VINF_SUCCESS;
    34773466            }
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