diff options
author | Vlad Yasevich <vyasevich@gmail.com> | 2015-05-01 17:36:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-05-04 00:14:13 -0400 |
commit | efdbd2b30caa65dd9e687853afa4d7ce8b39447e (patch) | |
tree | b67a7c4723ad11c3f84a448ea8130aeda9c40b2d | |
parent | 2e70aedd3d522b018c01df172cd213a8a75e2d55 (diff) |
macvlan: Propagate promiscuity setting to lower devices.
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/macvlan.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index b227a13f6473..9f59f17dc317 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -599,10 +599,18 @@ static int macvlan_open(struct net_device *dev) | |||
599 | goto del_unicast; | 599 | goto del_unicast; |
600 | } | 600 | } |
601 | 601 | ||
602 | if (dev->flags & IFF_PROMISC) { | ||
603 | err = dev_set_promiscuity(lowerdev, 1); | ||
604 | if (err < 0) | ||
605 | goto clear_multi; | ||
606 | } | ||
607 | |||
602 | hash_add: | 608 | hash_add: |
603 | macvlan_hash_add(vlan); | 609 | macvlan_hash_add(vlan); |
604 | return 0; | 610 | return 0; |
605 | 611 | ||
612 | clear_multi: | ||
613 | dev_set_allmulti(lowerdev, -1); | ||
606 | del_unicast: | 614 | del_unicast: |
607 | dev_uc_del(lowerdev, dev->dev_addr); | 615 | dev_uc_del(lowerdev, dev->dev_addr); |
608 | out: | 616 | out: |
@@ -638,6 +646,9 @@ static int macvlan_stop(struct net_device *dev) | |||
638 | if (dev->flags & IFF_ALLMULTI) | 646 | if (dev->flags & IFF_ALLMULTI) |
639 | dev_set_allmulti(lowerdev, -1); | 647 | dev_set_allmulti(lowerdev, -1); |
640 | 648 | ||
649 | if (dev->flags & IFF_PROMISC) | ||
650 | dev_set_promiscuity(lowerdev, -1); | ||
651 | |||
641 | dev_uc_del(lowerdev, dev->dev_addr); | 652 | dev_uc_del(lowerdev, dev->dev_addr); |
642 | 653 | ||
643 | hash_del: | 654 | hash_del: |
@@ -696,6 +707,10 @@ static void macvlan_change_rx_flags(struct net_device *dev, int change) | |||
696 | if (dev->flags & IFF_UP) { | 707 | if (dev->flags & IFF_UP) { |
697 | if (change & IFF_ALLMULTI) | 708 | if (change & IFF_ALLMULTI) |
698 | dev_set_allmulti(lowerdev, dev->flags & IFF_ALLMULTI ? 1 : -1); | 709 | dev_set_allmulti(lowerdev, dev->flags & IFF_ALLMULTI ? 1 : -1); |
710 | if (change & IFF_PROMISC) | ||
711 | dev_set_promiscuity(lowerdev, | ||
712 | dev->flags & IFF_PROMISC ? 1 : -1); | ||
713 | |||
699 | } | 714 | } |
700 | } | 715 | } |
701 | 716 | ||