Skip to content

Commit b13ba1b

Browse files
jasowangdavem330
authored andcommitted
macvlan: forbid L2 fowarding offload for macvtap
L2 fowarding offload will bypass the rx handler of real device. This will make the packet could not be forwarded to macvtap device. Another problem is the dev_hard_start_xmit() called for macvtap does not have any synchronization. Fix this by forbidding L2 forwarding for macvtap. Cc: John Fastabend <[email protected]> Cc: Neil Horman <[email protected]> Acked-by: Neil Horman <[email protected]> Signed-off-by: Jason Wang <[email protected]> Acked-by: John Fastabend <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c4d7099 commit b13ba1b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/net/macvlan.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,8 @@ static const struct header_ops macvlan_hard_header_ops = {
338338
.cache_update = eth_header_cache_update,
339339
};
340340

341+
static struct rtnl_link_ops macvlan_link_ops;
342+
341343
static int macvlan_open(struct net_device *dev)
342344
{
343345
struct macvlan_dev *vlan = netdev_priv(dev);
@@ -353,7 +355,8 @@ static int macvlan_open(struct net_device *dev)
353355
goto hash_add;
354356
}
355357

356-
if (lowerdev->features & NETIF_F_HW_L2FW_DOFFLOAD) {
358+
if (lowerdev->features & NETIF_F_HW_L2FW_DOFFLOAD &&
359+
dev->rtnl_link_ops == &macvlan_link_ops) {
357360
vlan->fwd_priv =
358361
lowerdev->netdev_ops->ndo_dfwd_add_station(lowerdev, dev);
359362

0 commit comments

Comments
 (0)