Skip to content

Commit b82816d

Browse files
shifty91gregkh
authored andcommitted
net: hsr: Reset MAC header for Tx path
commit 9d68039 upstream. Reset MAC header in HSR Tx path. This is needed, because direct packet transmission, e.g. by specifying PACKET_QDISC_BYPASS does not reset the MAC header. This has been observed using the following setup: |$ ip link add name hsr0 type hsr slave1 lan0 slave2 lan1 supervision 45 version 1 |$ ifconfig hsr0 up |$ ./test hsr0 The test binary is using mmap'ed sockets and is specifying the PACKET_QDISC_BYPASS socket option. This patch resolves the following warning on a non-patched kernel: |[ 112.725394] ------------[ cut here ]------------ |[ 112.731418] WARNING: CPU: 1 PID: 257 at net/hsr/hsr_forward.c:560 hsr_forward_skb+0x484/0x568 |[ 112.739962] net/hsr/hsr_forward.c:560: Malformed frame (port_src hsr0) The warning can be safely removed, because the other call sites of hsr_forward_skb() make sure that the skb is prepared correctly. Fixes: d346a3f ("packet: introduce PACKET_QDISC_BYPASS socket option") Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9b9c910 commit b82816d

2 files changed

Lines changed: 1 addition & 6 deletions

File tree

‎net/hsr/hsr_device.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ static netdev_tx_t hsr_dev_xmit(struct sk_buff *skb, struct net_device *dev)
217217
master = hsr_port_get_hsr(hsr, HSR_PT_MASTER);
218218
if (master) {
219219
skb->dev = master->dev;
220+
skb_reset_mac_header(skb);
220221
hsr_forward_skb(skb, master);
221222
} else {
222223
atomic_long_inc(&dev->tx_dropped);

‎net/hsr/hsr_forward.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -528,12 +528,6 @@ void hsr_forward_skb(struct sk_buff *skb, struct hsr_port *port)
528528
{
529529
struct hsr_frame_info frame;
530530

531-
if (skb_mac_header(skb) != skb->data) {
532-
WARN_ONCE(1, "%s:%d: Malformed frame (port_src %s)\n",
533-
__FILE__, __LINE__, port->dev->name);
534-
goto out_drop;
535-
}
536-
537531
if (fill_frame_info(&frame, skb, port) < 0)
538532
goto out_drop;
539533

0 commit comments

Comments
 (0)