vlan: allow to change type when no vlan device is hooked on netdev
authorJiri Pirko <jiri@resnulli.us>
Wed, 17 Oct 2012 01:37:36 +0000 (01:37 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 18 Oct 2012 19:34:30 +0000 (15:34 -0400)
vlan_info might be present but still no vlan devices might be there.
That is in case of vlan0 automatically added.

So in that case, allow to change netdev type.

Reported-by: Jon Stanley <jstanley@rmrf.net>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/8021q/vlan.c

index 9096bcb081326c92bb64b6dedb11033073998ca5..ee070722a3a36f1916b385e8872ea505105d06bb 100644 (file)
@@ -463,7 +463,9 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
 
        case NETDEV_PRE_TYPE_CHANGE:
                /* Forbid underlaying device to change its type. */
-               return NOTIFY_BAD;
+               if (vlan_uses_dev(dev))
+                       return NOTIFY_BAD;
+               break;
 
        case NETDEV_NOTIFY_PEERS:
        case NETDEV_BONDING_FAILOVER: