[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240711070828.2741351-3-boris.sukholitko@broadcom.com>
Date: Thu, 11 Jul 2024 10:08:28 +0300
From: Boris Sukholitko <boris.sukholitko@...adcom.com>
To: netdev@...r.kernel.org,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Eduard Zingerman <eddyz87@...il.com>,
Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>,
Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Pravin B Shelar <pshelar@....org>,
Jamal Hadi Salim <jhs@...atatu.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Jiri Pirko <jiri@...nulli.us>,
Willem de Bruijn <willemb@...gle.com>,
Simon Horman <horms@...nel.org>,
Florian Westphal <fw@...len.de>,
Mina Almasry <almasrymina@...gle.com>,
Abhishek Chauhan <quic_abchauha@...cinc.com>,
David Howells <dhowells@...hat.com>,
Alexander Lobakin <aleksander.lobakin@...el.com>,
Pavel Begunkov <asml.silence@...il.com>,
Lorenzo Bianconi <lorenzo@...nel.org>,
Thomas Weißschuh <linux@...ssschuh.net>
Cc: Ilya Lifshits <ilya.lifshits@...adcom.com>
Subject: [PATCH net-next 2/2] tc vlan: adjust network header in tcf_vlan_act
When double-tagged VLAN packet enters Linux network stack the outer
vlan is stripped and copied to the skb. As a result, skb->data points
to the inner vlan.
When second vlan is pushed by tcf_vlan_act, skb->mac_len will be advanced
by skb_vlan_push. As a result, the final skb_pull_rcsum will have
network header pointing to the inner protocol header (e.g. IP) rather than
inner vlan as expected. This causes a problem with further TC processing
as __skb_flow_dissect expects the network header to point to the inner
vlan.
To fix this problem, we disable skb->mac_len advancement and reset
network header and mac_len at the end of tcf_vlan_act.
Signed-off-by: Boris Sukholitko <boris.sukholitko@...adcom.com>
---
net/sched/act_vlan.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c
index f60cf7062572..8de6f363885b 100644
--- a/net/sched/act_vlan.c
+++ b/net/sched/act_vlan.c
@@ -51,7 +51,7 @@ TC_INDIRECT_SCOPE int tcf_vlan_act(struct sk_buff *skb,
case TCA_VLAN_ACT_PUSH:
err = skb_vlan_push(skb, p->tcfv_push_proto, p->tcfv_push_vid |
(p->tcfv_push_prio << VLAN_PRIO_SHIFT),
- VLAN_HLEN);
+ 0);
if (err)
goto drop;
break;
@@ -94,8 +94,11 @@ TC_INDIRECT_SCOPE int tcf_vlan_act(struct sk_buff *skb,
}
out:
- if (skb_at_tc_ingress(skb))
+ if (skb_at_tc_ingress(skb)) {
skb_pull_rcsum(skb, skb->mac_len);
+ skb_reset_network_header(skb);
+ skb_reset_mac_len(skb);
+ }
return action;
--
2.42.0
Download attachment "smime.p7s" of type "application/pkcs7-signature" (4221 bytes)
Powered by blists - more mailing lists