Skip to content

Commit

Permalink
ipvlan: play well with macvlan device
Browse files Browse the repository at this point in the history
If a device is already a macvlan port then refuse to use it as
an ipvlan port in the early stage of port creation.

	thost1:~# ip link add link eth0 mvl0 type macvlan
	thost1:~# echo $?
	0
	thost1:~# ip link add link eth0 ipvl0 type ipvlan
	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>
  • Loading branch information
Mahesh Bandewar authored and David S. Miller committed Dec 9, 2014
1 parent 2f33e7d commit 764e433
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/ipvlan/ipvlan_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ static int ipvlan_port_create(struct net_device *dev)
netdev_err(dev, "Master is either lo or non-ether device\n");
return -EINVAL;
}

if (netif_is_macvlan_port(dev)) {
netdev_err(dev, "Master is a macvlan port.\n");
return -EBUSY;
}

port = kzalloc(sizeof(struct ipvl_port), GFP_KERNEL);
if (!port)
return -ENOMEM;
Expand Down

0 comments on commit 764e433

Please sign in to comment.