Skip to content

Commit 8a50f11

Browse files
Vlad Yasevichdavem330
authored andcommitted
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 <[email protected]> CC: Michael S. Tsirkin <[email protected]> CC: Jason Wang <[email protected]> Signed-off-by: Vladislav Yasevich <[email protected]> Acked-by: John Fastabend <[email protected]> Acked-by: Michael S. Tsirkin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent dc80811 commit 8a50f11

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/net/macvlan.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,10 @@ static int macvlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
739739
struct macvlan_dev *vlan = netdev_priv(dev);
740740
int err = -EINVAL;
741741

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))
743746
return -EOPNOTSUPP;
744747

745748
if (flags & NLM_F_REPLACE)
@@ -760,7 +763,10 @@ static int macvlan_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
760763
struct macvlan_dev *vlan = netdev_priv(dev);
761764
int err = -EINVAL;
762765

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))
764770
return -EOPNOTSUPP;
765771

766772
if (is_unicast_ether_addr(addr))

0 commit comments

Comments
 (0)