提交 a6ca5f1d 编写于 作者: P Patrick McHardy 提交者: David S. Miller

[MACVLAN]: Prevent nesting macvlan devices

Don't allow to nest macvlan devices since it will cause lockdep
warnings and isn't really useful for anything.
Signed-off-by: NPatrick McHardy <kaber@trash.net>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 0fe1e567
......@@ -384,6 +384,13 @@ static int macvlan_newlink(struct net_device *dev,
if (lowerdev == NULL)
return -ENODEV;
/* Don't allow macvlans on top of other macvlans - its not really
* wrong, but lockdep can't handle it and its not useful for anything
* you couldn't do directly on top of the real device.
*/
if (lowerdev->rtnl_link_ops == dev->rtnl_link_ops)
return -ENODEV;
if (!tb[IFLA_MTU])
dev->mtu = lowerdev->mtu;
else if (dev->mtu > lowerdev->mtu)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册