VirtualBox

Changeset 58207 in vbox


Ignore:
Timestamp:
Oct 12, 2015 9:29:02 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
103326
Message:

VBoxNetAdp/linux: do the ritual netif_carrier_off/netif_carrier_on
song and dance so that when the interface goes IFF_UP it ends up in
operstate IF_OPER_UP, not unknown.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c

    r57841 r58207  
    200200            memcpy(pNetDev->dev_addr, pMACAddress, ETH_ALEN);
    201201            Log2(("vboxNetAdpOsCreate: pNetDev->dev_addr = %.6Rhxd\n", pNetDev->dev_addr));
     202
     203            /*
     204             * To get proper operstate transition to IF_OPER_UP we
     205             * need to call netif_carrier_on(), which triggers netlink
     206             * notifications that do the work.  But first we need to
     207             * turn it off here, otherwise that call will do nothing
     208             * and we will be stuck in IF_OPER_UNKNOWN.
     209             *
     210             * Do this before registration so that only the state bit
     211             * is set, but no state change notifications are generated.
     212             */
     213            netif_carrier_off(pNetDev);
     214
    202215            err = register_netdev(pNetDev);
    203216            if (!err)
     
    206219                pThis->szName[sizeof(pThis->szName) - 1] = '\0';
    207220                pThis->u.s.pNetDev = pNetDev;
     221
     222                /*
     223                 * TODO: We might want to set carrier only when
     224                 * VBoxNetFlt attaches the intnet to us.
     225                 */
     226                netif_carrier_on(pNetDev);
     227
    208228                Log2(("vboxNetAdpOsCreate: pThis=%p pThis->szName = %p\n", pThis, pThis->szName));
    209229                return VINF_SUCCESS;
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