diff options
author | Vlad Yasevich <vyasevic@redhat.com> | 2014-08-15 13:04:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-08-21 19:54:25 -0400 |
commit | 8a50f11c3b176d7a1df8cd5e29cbe965905e51ee (patch) | |
tree | 0f31a7bde805088a72152407f43ab9b34b8213a4 /drivers/net/macvlan.c | |
parent | dc808110bb62b64a448696ecac3938902c92e1ab (diff) |
macvlan: Allow setting multicast filter on all macvlan types
Currently, macvlan code restricts multicast and unicast
filter setting only to passthru devices. As a result,
if a guest using macvtap wants to receive multicast
traffic, it has to set IFF_ALLMULTI or IFF_PROMISC.
This patch makes it possible to use the fdb interface
to add multicast addresses to the filter thus allowing
a guest to receive only targeted multicast traffic.
CC: John Fastabend <john.r.fastabend@intel.com>
CC: Michael S. Tsirkin <mst@redhat.com>
CC: Jason Wang <jasowang@redhat.com>
Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
Acked-by: John Fastabend <john.r.fastabend@intel.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/macvlan.c')
-rw-r--r-- | drivers/net/macvlan.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 60e4ca01ccbb..a96955597755 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -739,7 +739,10 @@ static int macvlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[], | |||
739 | struct macvlan_dev *vlan = netdev_priv(dev); | 739 | struct macvlan_dev *vlan = netdev_priv(dev); |
740 | int err = -EINVAL; | 740 | int err = -EINVAL; |
741 | 741 | ||
742 | if (!vlan->port->passthru) | 742 | /* Support unicast filter only on passthru devices. |
743 | * Multicast filter should be allowed on all devices. | ||
744 | */ | ||
745 | if (!vlan->port->passthru && is_unicast_ether_addr(addr)) | ||
743 | return -EOPNOTSUPP; | 746 | return -EOPNOTSUPP; |
744 | 747 | ||
745 | if (flags & NLM_F_REPLACE) | 748 | if (flags & NLM_F_REPLACE) |
@@ -760,7 +763,10 @@ static int macvlan_fdb_del(struct ndmsg *ndm, struct nlattr *tb[], | |||
760 | struct macvlan_dev *vlan = netdev_priv(dev); | 763 | struct macvlan_dev *vlan = netdev_priv(dev); |
761 | int err = -EINVAL; | 764 | int err = -EINVAL; |
762 | 765 | ||
763 | if (!vlan->port->passthru) | 766 | /* Support unicast filter only on passthru devices. |
767 | * Multicast filter should be allowed on all devices. | ||
768 | */ | ||
769 | if (!vlan->port->passthru && is_unicast_ether_addr(addr)) | ||
764 | return -EOPNOTSUPP; | 770 | return -EOPNOTSUPP; |
765 | 771 | ||
766 | if (is_unicast_ether_addr(addr)) | 772 | if (is_unicast_ether_addr(addr)) |