netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 2/4] ipvlan: play well with macvlan device
@ 2014-12-06 23:53 Mahesh Bandewar
  2014-12-09 21:10 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Mahesh Bandewar @ 2014-12-06 23:53 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, Eric Dumazet, Mahesh Bandewar

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>
---
 drivers/net/ipvlan/ipvlan_main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index 96b71b0d78f6..a706a547d811 100644
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -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;
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next 2/4] ipvlan: play well with macvlan device
  2014-12-06 23:53 [PATCH net-next 2/4] ipvlan: play well with macvlan device Mahesh Bandewar
@ 2014-12-09 21:10 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-12-09 21:10 UTC (permalink / raw)
  To: maheshb; +Cc: netdev, edumazet

From: Mahesh Bandewar <maheshb@google.com>
Date: Sat,  6 Dec 2014 15:53:19 -0800

> 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>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-09 21:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-06 23:53 [PATCH net-next 2/4] ipvlan: play well with macvlan device Mahesh Bandewar
2014-12-09 21:10 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).