• Nikolay Aleksandrov's avatar
    macvlan: make operstate and carrier more accurate · de7d244d
    Nikolay Aleksandrov authored
    Currently when a macvlan is being initialized and the lower device is
    netif_carrier_ok(), the macvlan device doesn't run through
    rfc2863_policy() and is left with UNKNOWN operstate. Fix it by adding an
    unconditional linkwatch event for the new macvlan device. Similar fix is
    already used by the 8021q device (see register_vlan_dev()). Also fix the
    inconsistent state when the lower device has been down and its carrier
    was changed (when a device is down NETDEV_CHANGE doesn't get generated).
    The second issue can be seen f.e. when we have a macvlan on top of a 8021q
    device which has been down and its real device has been changing carrier
    states, after setting the 8021q device up, the macvlan device will have
    the same carrier state as it was before even though the 8021q can now
    have a different state.
    Example for case 1:
    4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
    state UP mode DEFAULT group default qlen 1000
    
    $ ip l add l eth2 macvl0 typ...
    de7d244d
macvlan.c 40 KB