Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Mahesh Bandewar and committed by
David S. Miller
d6b00fec 5933fea7

+3
+3
drivers/net/macvlan.c
··· 1057 1057 if (dev->type != ARPHRD_ETHER || dev->flags & IFF_LOOPBACK) 1058 1058 return -EINVAL; 1059 1059 1060 + if (netif_is_ipvlan_port(dev)) 1061 + return -EBUSY; 1062 + 1060 1063 port = kzalloc(sizeof(*port), GFP_KERNEL); 1061 1064 if (port == NULL) 1062 1065 return -ENOMEM;