Skip to content

Commit 764e433

Browse files
Mahesh Bandewardavem330
authored andcommitted
ipvlan: play well with macvlan device
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>
1 parent 2f33e7d commit 764e433

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/net/ipvlan/ipvlan_main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ static int ipvlan_port_create(struct net_device *dev)
3838
netdev_err(dev, "Master is either lo or non-ether device\n");
3939
return -EINVAL;
4040
}
41+
42+
if (netif_is_macvlan_port(dev)) {
43+
netdev_err(dev, "Master is a macvlan port.\n");
44+
return -EBUSY;
45+
}
46+
4147
port = kzalloc(sizeof(struct ipvl_port), GFP_KERNEL);
4248
if (!port)
4349
return -ENOMEM;

0 commit comments

Comments
 (0)