[PATCH 4.12 35/52] bridge: switchdev: Clear forward mark when transmitting packet
From: Greg Kroah-Hartman
Date: Mon Sep 18 2017 - 05:13:37 EST
4.12-stable review patch. If anyone has any objections, please let me know.
From: Ido Schimmel <idosch@xxxxxxxxxxxx>
[ Upstream commit 79e99bdd60b484af9afe0147e85a13e66d5c1cdb ]
Commit 6bc506b4fb06 ("bridge: switchdev: Add forward mark support for
stacked devices") added the 'offload_fwd_mark' bit to the skb in order
to allow drivers to indicate to the bridge driver that they already
forwarded the packet in L2.
In case the bit is set, before transmitting the packet from each port,
the port's mark is compared with the mark stored in the skb's control
block. If both marks are equal, we know the packet arrived from a switch
device that already forwarded the packet and it's not re-transmitted.
However, if the packet is transmitted from the bridge device itself
(e.g., br0), we should clear the 'offload_fwd_mark' bit as the mark
stored in the skb's control block isn't valid.
This scenario can happen in rare cases where a packet was trapped during
L3 forwarding and forwarded by the kernel to a bridge device.
Fixes: 6bc506b4fb06 ("bridge: switchdev: Add forward mark support for stacked devices")
Signed-off-by: Ido Schimmel <idosch@xxxxxxxxxxxx>
Reported-by: Yotam Gigi <yotamg@xxxxxxxxxxxx>
Tested-by: Yotam Gigi <yotamg@xxxxxxxxxxxx>
Reviewed-by: Jiri Pirko <jiri@xxxxxxxxxxxx>
Acked-by: Nikolay Aleksandrov <nikolay@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
net/bridge/br_device.c | 3 +++
1 file changed, 3 insertions(+)
@@ -53,6 +53,9 @@ netdev_tx_t br_dev_xmit(struct sk_buff *
brstats->tx_bytes += skb->len;
+ skb->offload_fwd_mark = 0;
BR_INPUT_SKB_CB(skb)->brdev = dev;