aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/macvlan.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-01-11 01:39:28 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-11 01:39:28 -0500
commita6ca5f1dbe40470fcb1ecc921769d792a1e77ed9 (patch)
treec74e49b849ff9806aa4349587c3623cb90ddf0e6 /drivers/net/macvlan.c
parent0fe1e567d0b4f6a98e94d3b9a40f41c801bd157f (diff)
[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: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/macvlan.c')
-rw-r--r--drivers/net/macvlan.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 2e4bcd5654c4..e8dc2f44fec9 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -384,6 +384,13 @@ static int macvlan_newlink(struct net_device *dev,
384 if (lowerdev == NULL) 384 if (lowerdev == NULL)
385 return -ENODEV; 385 return -ENODEV;
386 386
387 /* Don't allow macvlans on top of other macvlans - its not really
388 * wrong, but lockdep can't handle it and its not useful for anything
389 * you couldn't do directly on top of the real device.
390 */
391 if (lowerdev->rtnl_link_ops == dev->rtnl_link_ops)
392 return -ENODEV;
393
387 if (!tb[IFLA_MTU]) 394 if (!tb[IFLA_MTU])
388 dev->mtu = lowerdev->mtu; 395 dev->mtu = lowerdev->mtu;
389 else if (dev->mtu > lowerdev->mtu) 396 else if (dev->mtu > lowerdev->mtu)