netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Setting security path with IPsec packet offload mode
@ 2023-06-22  6:58 Bharat Bhushan
  2023-06-22  8:35 ` Leon Romanovsky
  0 siblings, 1 reply; 5+ messages in thread
From: Bharat Bhushan @ 2023-06-22  6:58 UTC (permalink / raw)
  To: Steffen Klassert, herbert@gondor.apana.org.au, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: netdev@vger.kernel.org

Hi All,

Have a query related to security patch (secpath_set()) with packet offload mode on egress side. Working to enable ipsec packet offload while Crypto offload is working.
For packet offload xfrm_offload(*skb) returns false in driver. While looking in xfrm framework, cannot find where security patch (secpath_set()) is set with packet offload mode on egress side.

For sure I might be missing something here and looking for help to understand same. Meantime just tried below hack:

diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index ff114d68cc43..8499c0e74a5a 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -718,12 +718,24 @@ int xfrm_output(struct sock *sk, struct sk_buff *skb)
        }
 
        if (x->xso.type == XFRM_DEV_OFFLOAD_PACKET) {
+               struct sec_path *sp;
                if (!xfrm_dev_offload_ok(skb, x)) {
                        XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTERROR);
                        kfree_skb(skb);
                        return -EHOSTUNREACH;
                }
 
+               sp = secpath_set(skb);
+               if (!sp) {
+                       XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTERROR);
+                       kfree_skb(skb);
+                       return -ENOMEM;
+               }
+
+               sp->olen++;
+               sp->xvec[sp->len++] = x;
+               xfrm_state_hold(x);
+
                return xfrm_output_resume(sk, skb, 0);
        }
 

Thanks in advance,
-Bharat

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-25  7:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-22  6:58 Setting security path with IPsec packet offload mode Bharat Bhushan
2023-06-22  8:35 ` Leon Romanovsky
2023-06-23  6:48   ` [EXT] " Bharat Bhushan
2023-06-23  7:01     ` Bharat Bhushan
2023-06-25  7:27     ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).