Skip to content

Commit d6b00fe

Browse files
Mahesh Bandewardavem330
authored andcommitted
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>
1 parent 5933fea commit d6b00fe

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/net/macvlan.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,9 @@ static int macvlan_port_create(struct net_device *dev)
10571057
if (dev->type != ARPHRD_ETHER || dev->flags & IFF_LOOPBACK)
10581058
return -EINVAL;
10591059

1060+
if (netif_is_ipvlan_port(dev))
1061+
return -EBUSY;
1062+
10601063
port = kzalloc(sizeof(*port), GFP_KERNEL);
10611064
if (port == NULL)
10621065
return -ENOMEM;

0 commit comments

Comments
 (0)