VirtualBox

Ignore:
Timestamp:
Oct 7, 2015 12:45:41 AM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
103126
Message:

VBoxNetAdp/darwin: Handle SIOCADDMULTI/SIOCDELMULTI with NULL argument
as a successful nop too. While here add debug logging for other ioctls.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetAdp/darwin/VBoxNetAdp-darwin.cpp

    r57913 r58070  
    220220    errno_t error = 0;
    221221
    222     switch (uCmd)
     222    if (pvData == NULL)
    223223    {
    224224        /*
    225          * Common pattern in the kernel code is:
     225         * Common pattern in the kernel code is to make changes in the
     226         * net layer and then notify the device driver by calling its
     227         * ioctl function with NULL parameter, e.g.:
     228         *
    226229         *   ifnet_set_flags(interface, ...);
    227230         *   ifnet_ioctl(interface, 0, SIOCSIFFLAGS, NULL);
    228231         *
    229          * Stub this case out so that VBoxNetFlt-darwin.cpp doesn't
    230          * complain that it failed to put vboxnet into promiscuous
    231          * mode.
     232         * These are no-ops for us, so tell the caller we succeeded
     233         * because some callers do check that return value.
    232234         */
    233         case SIOCSIFFLAGS:
    234             if (pvData != NULL)
    235             {
    236                 error = ENOTSUP;
    237             }
    238             break;
    239 
    240         default:
    241             error = ether_ioctl(pIface, uCmd, pvData);
    242             break;
     235        switch (uCmd)
     236        {
     237            case SIOCSIFFLAGS:
     238                Log2(("VBoxNetAdp: %s%d: SIOCSIFFLAGS (null): flags = 0x%04hx\n",
     239                      ifnet_name(pIface), ifnet_unit(pIface),
     240                      (uint16_t)ifnet_flags(pIface)));
     241                return 0;
     242
     243            case SIOCADDMULTI:
     244            case SIOCDELMULTI:
     245                Log2(("VBoxNetAdp: %s%d: SIOC%sMULTI (null)\n",
     246                      ifnet_name(pIface), ifnet_unit(pIface),
     247                      uCmd == SIOCADDMULTI ? "ADD" : "DEL"));
     248                return 0;
     249        }
    243250    }
    244251
     252    Log2(("VBoxNetAdp: %s%d: %c%c '%c' %u len %u\n",
     253          ifnet_name(pIface), ifnet_unit(pIface),
     254          uCmd & IOC_OUT ? '<' : '-',
     255          uCmd & IOC_IN  ? '>' : '-',
     256          IOCGROUP(uCmd),
     257          uCmd & 0xff,
     258          IOCPARM_LEN(uCmd)));
     259
     260    error = ether_ioctl(pIface, uCmd, pvData);
    245261    return error;
    246262}
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette