netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] macvlan: Propagate promiscuity setting to lower devices.
@ 2015-05-01 21:36 Vladislav Yasevich
  2015-05-04  4:14 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Vladislav Yasevich @ 2015-05-01 21:36 UTC (permalink / raw)
  To: netdev; +Cc: Vladislav Yasevich

When a macvlan device is placed in promiscuous mode, it currently
just sets it's multicast mask to permissive, but doesn't change
the state of the lower device.  As a result, not all multicast
traffic can be received on such device.  Additionally, none of
a vlan traffic can be received on such device as well.
This patch propagates the promiscuous mode setting to lower device
so that lower device may receive all packets that macvlan may
be interested in.

Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
---
 drivers/net/macvlan.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index b227a13..806e83d 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -599,10 +599,18 @@ static int macvlan_open(struct net_device *dev)
 			goto del_unicast;
 	}
 
+	if (dev->flags & IFF_PROMISC) {
+		err = dev_set_promiscuity(lowerdev, 1);
+		if (err < 0)
+			goto clear_multi;
+	}
+
 hash_add:
 	macvlan_hash_add(vlan);
 	return 0;
 
+clear_multi:
+	dev_set_allmulti(lowerdev, -1);
 del_unicast:
 	dev_uc_del(lowerdev, dev->dev_addr);
 out:
@@ -638,6 +646,9 @@ static int macvlan_stop(struct net_device *dev)
 	if (dev->flags & IFF_ALLMULTI)
 		dev_set_allmulti(lowerdev, -1);
 
+	if (dev->flags & IFF_PROMISC)
+		dev_set_promiscuity(lowerdev, -1);
+
 	dev_uc_del(lowerdev, dev->dev_addr);
 
 hash_del:
@@ -696,6 +707,10 @@ static void macvlan_change_rx_flags(struct net_device *dev, int change)
 	if (dev->flags & IFF_UP) {
 		if (change & IFF_ALLMULTI)
 			dev_set_allmulti(lowerdev, dev->flags & IFF_ALLMULTI ? 1 : -1);
+		if (change & IFF_PROMISC)
+			dev_set_promiscuity(lowerdev,
+					    dev->flags & IFF_PROMISC ? 1 : -1);
+
 	}
 }
 
-- 
1.9.3

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

* Re: [PATCH] macvlan: Propagate promiscuity setting to lower devices.
  2015-05-01 21:36 [PATCH] macvlan: Propagate promiscuity setting to lower devices Vladislav Yasevich
@ 2015-05-04  4:14 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-05-04  4:14 UTC (permalink / raw)
  To: vyasevich; +Cc: netdev, vyasevic

From: Vladislav Yasevich <vyasevich@gmail.com>
Date: Fri,  1 May 2015 17:36:37 -0400

> When a macvlan device is placed in promiscuous mode, it currently
> just sets it's multicast mask to permissive, but doesn't change
> the state of the lower device.  As a result, not all multicast
> traffic can be received on such device.  Additionally, none of
> a vlan traffic can be received on such device as well.
> This patch propagates the promiscuous mode setting to lower device
> so that lower device may receive all packets that macvlan may
> be interested in.
> 
> Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>

Applied, thanks Vlad.

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

end of thread, other threads:[~2015-05-04  4:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-01 21:36 [PATCH] macvlan: Propagate promiscuity setting to lower devices Vladislav Yasevich
2015-05-04  4:14 ` 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).