This is a preparatory change for the deletion of skb_reset_mac_header(skb)
from __dev_queue_xmit(). After that deletion, skb_mac_header(skb) will
no longer be set in TX paths, from which __vlan_insert_inner_tag() can
still be called (perhaps indirectly).
If we don't make this change, then an unset MAC header (equal to ~0U)
will become set after the adjustment with VLAN_HLEN.
Signed-off-by: Vladimir Oltean <[email protected]>
---
include/linux/if_vlan.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 6864b89ef868..90b76d63c11c 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -351,7 +351,8 @@ static inline int __vlan_insert_inner_tag(struct sk_buff *skb,
/* Move the mac header sans proto to the beginning of the new header. */
if (likely(mac_len > ETH_TLEN))
memmove(skb->data, skb->data + VLAN_HLEN, mac_len - ETH_TLEN);
- skb->mac_header -= VLAN_HLEN;
+ if (skb_mac_header_was_set(skb))
+ skb->mac_header -= VLAN_HLEN;
veth = (struct vlan_ethhdr *)(skb->data + mac_len - ETH_HLEN);
--
2.34.1
On Thu, Mar 23, 2023 at 01:38:15AM +0200, Vladimir Oltean wrote:
> This is a preparatory change for the deletion of skb_reset_mac_header(skb)
> from __dev_queue_xmit(). After that deletion, skb_mac_header(skb) will
> no longer be set in TX paths, from which __vlan_insert_inner_tag() can
> still be called (perhaps indirectly).
>
> If we don't make this change, then an unset MAC header (equal to ~0U)
> will become set after the adjustment with VLAN_HLEN.
>
> Signed-off-by: Vladimir Oltean <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
On 3/22/23 16:38, Vladimir Oltean wrote:
> This is a preparatory change for the deletion of skb_reset_mac_header(skb)
> from __dev_queue_xmit(). After that deletion, skb_mac_header(skb) will
> no longer be set in TX paths, from which __vlan_insert_inner_tag() can
> still be called (perhaps indirectly).
>
> If we don't make this change, then an unset MAC header (equal to ~0U)
> will become set after the adjustment with VLAN_HLEN.
>
> Signed-off-by: Vladimir Oltean <[email protected]>
Reviewed-by: Florian Fainelli <[email protected]>
--
Florian