Commit f4637b55ba960d9987a836617271659e9b7b0de8

Authored by Tommy Christensen
Committed by David S. Miller
1 parent ab611487d8

[VLAN]: Fix early vlan adding leads to not functional device

OK, I can see what's happening here. eth0 doesn't detect link-up until
after a few seconds, so when the vlan interface is opened immediately
after eth0 has been opened, it inherits the link-down state. Subsequently
the vlan interface is never properly activated and are thus unable to
transmit any packets.

dev->state bits are not supposed to be manipulated directly. Something
similar is probably needed for the netif_device_present() bit, although
I don't know how this is meant to work for a virtual device.

Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 8 additions and 0 deletions Side-by-side Diff

... ... @@ -578,6 +578,14 @@
578 578 if (!vlandev)
579 579 continue;
580 580  
  581 + if (netif_carrier_ok(dev)) {
  582 + if (!netif_carrier_ok(vlandev))
  583 + netif_carrier_on(vlandev);
  584 + } else {
  585 + if (netif_carrier_ok(vlandev))
  586 + netif_carrier_off(vlandev);
  587 + }
  588 +
581 589 if ((vlandev->state & VLAN_LINK_STATE_MASK) != flgs) {
582 590 vlandev->state = (vlandev->state &~ VLAN_LINK_STATE_MASK)
583 591 | flgs;