提交 1c01fe14 编写于 作者: J Jiri Pirko 提交者: David S. Miller

net: forbid underlaying devices to change its type

It's not desired for underlaying devices to change type. At the time,
there is for example possible to have bond with changed type from
Ethernet to Infiniband as a port of a bridge. This patch fixes this.
Signed-off-by: NJiri Pirko <jpirko@redhat.com>
Signed-off-by: NJay Vosburgh <fubar@us.ibm.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 3ca5b404
...@@ -748,6 +748,9 @@ static int macvlan_device_event(struct notifier_block *unused, ...@@ -748,6 +748,9 @@ static int macvlan_device_event(struct notifier_block *unused,
list_for_each_entry_safe(vlan, next, &port->vlans, list) list_for_each_entry_safe(vlan, next, &port->vlans, list)
vlan->dev->rtnl_link_ops->dellink(vlan->dev, NULL); vlan->dev->rtnl_link_ops->dellink(vlan->dev, NULL);
break; break;
case NETDEV_PRE_TYPE_CHANGE:
/* Forbid underlaying device to change its type. */
return NOTIFY_BAD;
} }
return NOTIFY_DONE; return NOTIFY_DONE;
} }
......
...@@ -530,6 +530,10 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, ...@@ -530,6 +530,10 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
} }
unregister_netdevice_many(&list); unregister_netdevice_many(&list);
break; break;
case NETDEV_PRE_TYPE_CHANGE:
/* Forbid underlaying device to change its type. */
return NOTIFY_BAD;
} }
out: out:
......
...@@ -82,6 +82,10 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v ...@@ -82,6 +82,10 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
case NETDEV_UNREGISTER: case NETDEV_UNREGISTER:
br_del_if(br, dev); br_del_if(br, dev);
break; break;
case NETDEV_PRE_TYPE_CHANGE:
/* Forbid underlaying device to change its type. */
return NOTIFY_BAD;
} }
/* Events that may cause spanning tree to refresh */ /* Events that may cause spanning tree to refresh */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册