Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8a50f11c authored by Vlad Yasevich's avatar Vlad Yasevich Committed by David S. Miller
Browse files

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: default avatarVladislav Yasevich <vyasevic@redhat.com>
Acked-by: default avatarJohn Fastabend <john.r.fastabend@intel.com>
Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent dc808110
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -739,7 +739,10 @@ static int macvlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
	struct macvlan_dev *vlan = netdev_priv(dev);
	int err = -EINVAL;

	if (!vlan->port->passthru)
	/* Support unicast filter only on passthru devices.
	 * Multicast filter should be allowed on all devices.
	 */
	if (!vlan->port->passthru && is_unicast_ether_addr(addr))
		return -EOPNOTSUPP;

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

	if (!vlan->port->passthru)
	/* Support unicast filter only on passthru devices.
	 * Multicast filter should be allowed on all devices.
	 */
	if (!vlan->port->passthru && is_unicast_ether_addr(addr))
		return -EOPNOTSUPP;

	if (is_unicast_ether_addr(addr))