batman-adv: Force mac header to start of data on xmit
Sven Eckelmann
maintainerPATCH 1/1 batman-adv: Force mac header to start of data on xmit
The caller of ndo_start_xmit may not already have called skb_reset_mac_header. The returned value of skb_mac_header/eth_hdr therefore can be in the wrong position and even outside the current skbuff. This for example happens when the user binds to the device using a PF_PACKET-SOCK_RAW with enabled qdisc-bypass:
int opt = 4; setsockopt(sock, SOL_PACKET, PACKET_QDISC_BYPASS, &opt, sizeof(opt));
Since eth_hdr is used all over the codebase, the batadv_interface_tx function must always take care of resetting it.
Fixes fe28a94c01e1 ("batman-adv: receive packets directly using skbs")
Reported-by [email protected]
Reported-by [email protected]
Signed-off-by Sven Eckelmann <[email protected]>
---
Cc: [email protected]
--- net/batman-adv/soft-interface.c | 2 ++ 1 file changed, 2 insertions(+)
net/batman-adv/soft-interface.c +2 -0
@@ -221,6 +221,8 @@ static netdev_tx_t batadv_interface_tx(struct sk_buff *skb,netif_trans_update (soft_iface); vid =batadv_get_vid (skb,0 ); + +skb_reset_mac_header (skb); ethhdr =eth_hdr (skb);switch (ntohs (ethhdr->h_proto)) {
Signature · 1 line
2.19.2