VirtualBox

Changeset 56485 in vbox for trunk/src


Ignore:
Timestamp:
Jun 17, 2015 4:30:44 PM (10 years ago)
Author:
vboxsync
Message:

Network/NetLwf: Do not pass link-local addresses to pfnNotifyHostAddress (#7661)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetLwf-win.cpp

    r56293 r56485  
    6666#  include <ndis.h>
    6767#endif
     68#include <mstcpip.h>
    6869RT_C_DECLS_END
    6970
     
    21832184}
    21842185
     2186/*
     2187 * Uncommenting the following line produces debug log messages on IP address changes,
     2188 * including wired interfaces. No actual calls to a switch port are made. This is for
     2189 * debug purposes only!
     2190 * #define VBOXNETLWFWIN_DEBUGIPADDRNOTIF 1
     2191 */
    21852192static void vboxNetLwfWinIpAddrChangeCallback(IN PVOID pvCtx,
    21862193                                              IN PMIB_UNICASTIPADDRESS_ROW pRow,
     
    21992206        return;
    22002207
    2201     if (pRow && pThis->pSwitchPort->pfnNotifyHostAddress)
     2208    if (   pRow
     2209#ifndef VBOXNETLWFWIN_DEBUGIPADDRNOTIF
     2210        && pThis->pSwitchPort->pfnNotifyHostAddress
     2211#endif /* !VBOXNETLWFWIN_DEBUGIPADDRNOTIF */
     2212       )
    22022213    {
    22032214        switch (pRow->Address.si_family)
    22042215        {
    22052216            case AF_INET:
     2217                if (   IN4_IS_ADDR_LINKLOCAL(&pRow->Address.Ipv4.sin_addr)
     2218                    || pRow->Address.Ipv4.sin_addr.s_addr == IN4ADDR_LOOPBACK)
     2219                {
     2220                    Log(("vboxNetLwfWinIpAddrChangeCallback: ignoring %s address (%RTnaipv4)\n",
     2221                         pRow->Address.Ipv4.sin_addr.s_addr == IN4ADDR_LOOPBACK ? "loopback" : "link-local",
     2222                         pRow->Address.Ipv4.sin_addr));
     2223                    break;
     2224                }
    22062225                Log(("vboxNetLwfWinIpAddrChangeCallback: %s IPv4 addr=%RTnaipv4 on luid=(%u,%u)\n",
    22072226                     fAdded ? "add" : "remove", pRow->Address.Ipv4.sin_addr,
    22082227                     pRow->InterfaceLuid.Info.IfType, pRow->InterfaceLuid.Info.NetLuidIndex));
     2228#ifndef VBOXNETLWFWIN_DEBUGIPADDRNOTIF
    22092229                pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort, fAdded, kIntNetAddrType_IPv4,
    22102230                                                         &pRow->Address.Ipv4.sin_addr);
     2231#endif /* !VBOXNETLWFWIN_DEBUGIPADDRNOTIF */
    22112232                break;
    22122233            case AF_INET6:
    2213                 Log(("vboxNetLwfWinIpAddrChangeCallback: %s IPv6 addr=%RTnaipv6 luid=(%u,%u)\n",
     2234                if (Ipv6AddressScope(pRow->Address.Ipv6.sin6_addr.u.Byte) <= ScopeLevelLink)
     2235                {
     2236                    Log(("vboxNetLwfWinIpAddrChangeCallback: ignoring link-local address (%RTnaipv6)\n",
     2237                         &pRow->Address.Ipv6.sin6_addr));
     2238                    break;
     2239                }
     2240                Log(("vboxNetLwfWinIpAddrChangeCallback: %s IPv6 addr=%RTnaipv6 scope=%d luid=(%u,%u)\n",
    22142241                     fAdded ? "add" : "remove", &pRow->Address.Ipv6.sin6_addr,
     2242                     Ipv6AddressScope(pRow->Address.Ipv6.sin6_addr.u.Byte),
    22152243                     pRow->InterfaceLuid.Info.IfType, pRow->InterfaceLuid.Info.NetLuidIndex));
     2244#ifndef VBOXNETLWFWIN_DEBUGIPADDRNOTIF
    22162245                pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort, fAdded, kIntNetAddrType_IPv6,
    22172246                                                         &pRow->Address.Ipv6.sin6_addr);
     2247#endif /* !VBOXNETLWFWIN_DEBUGIPADDRNOTIF */
    22182248                break;
    22192249        }
     
    22262256void vboxNetLwfWinRegisterIpAddrNotifier(PVBOXNETFLTINS pThis)
    22272257{
    2228     if (pThis->pSwitchPort && pThis->pSwitchPort->pfnNotifyHostAddress)
     2258    LogFlow(("==>vboxNetLwfWinRegisterIpAddrNotifier: instance=%p\n", pThis));
     2259    if (   pThis->pSwitchPort
     2260#ifndef VBOXNETLWFWIN_DEBUGIPADDRNOTIF
     2261        && pThis->pSwitchPort->pfnNotifyHostAddress
     2262#endif /* !VBOXNETLWFWIN_DEBUGIPADDRNOTIF */
     2263       )
    22292264    {
    22302265        NETIO_STATUS Status;
     
    22492284    else
    22502285        pThis->u.s.WinIf.hNotifier = NULL;
     2286    LogFlow(("<==vboxNetLwfWinRegisterIpAddrNotifier\n"));
    22512287}
    22522288
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