Subject: [PATCH] [PATCH ipsec] xfrm: Store ipsec interface index

From: Feng Wang <[email-masked]>
Date: Mon, 18 Mar 2024 16:13:28 -0700

From: wangfe <[email-masked]>

When there are multiple ipsec sessions, packet offload driver
can use the index to distinguish the packets from the different
sessions even though xfrm_selector are same. Thus each packet is
handled corresponding to its session parameter.

Signed-off-by: wangfe <[email-masked]>
---
 net/xfrm/xfrm_interface_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/xfrm/xfrm_interface_core.c b/net/xfrm/xfrm_interface_core.c
index 21d50d75c260..996571af53e5 100644
--- a/net/xfrm/xfrm_interface_core.c
+++ b/net/xfrm/xfrm_interface_core.c
@@ -506,7 +506,9 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
 	xfrmi_scrub_packet(skb, !net_eq(xi->net, dev_net(dev)));
 	skb_dst_set(skb, dst);
 	skb->dev = tdev;
-
+#ifdef CONFIG_XFRM_OFFLOAD
+	skb->skb_iif = if_id;
+#endif
 	err = dst_output(xi->net, skb->sk, skb);
 	if (net_xmit_eval(err) == 0) {
 		dev_sw_netstats_tx_add(dev, 1, length);
-- 
2.44.0.291.gc1ea87d7ee-goog