aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMahesh Bandewar <maheshb@google.com>2014-12-06 18:53:46 -0500
committerDavid S. Miller <davem@davemloft.net>2014-12-09 16:10:06 -0500
commitd6b00fec5dbbe976904b4d77e7d4f9493df5c2ec (patch)
treecf7a45490bd487bd725dee5cfb3830ea22277798
parent5933fea7aa7237ba52d67c069c39ad5c3ab7a036 (diff)
macvlan: play well with ipvlan device
If device is already used as an ipvlan port then refuse to use it as a macvlan port at early stage of port creation. thost1:~# ip link add link eth0 ipvl0 type ipvlan thost1:~# echo $? 0 thost1:~# ip link add link eth0 mvl0 type macvlan RTNETLINK answers: Device or resource busy thost1:~# echo $? 2 thost1:~# Signed-off-by: Mahesh Bandewar <maheshb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/macvlan.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 10604db2a3a0..612e0731142d 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -1057,6 +1057,9 @@ static int macvlan_port_create(struct net_device *dev)
1057 if (dev->type != ARPHRD_ETHER || dev->flags & IFF_LOOPBACK) 1057 if (dev->type != ARPHRD_ETHER || dev->flags & IFF_LOOPBACK)
1058 return -EINVAL; 1058 return -EINVAL;
1059 1059
1060 if (netif_is_ipvlan_port(dev))
1061 return -EBUSY;
1062
1060 port = kzalloc(sizeof(*port), GFP_KERNEL); 1063 port = kzalloc(sizeof(*port), GFP_KERNEL);
1061 if (port == NULL) 1064 if (port == NULL)
1062 return -ENOMEM; 1065 return -ENOMEM;