summaryrefslogtreecommitdiffstats
path: root/net/xfrm
diff options
context:
space:
mode:
authorMike Yu <yumike@google.com>2024-07-12 10:51:24 +0800
committerSteffen Klassert <steffen.klassert@secunet.com>2024-07-12 08:43:29 +0200
commit4ecbac84b5b8c4ad033b473782582568810baf61 (patch)
tree9ce1c63d971bf027a2c580fbcbb0b57c448fa7b3 /net/xfrm
parenta10fb4a84a693891b2e205684456d0825363fc24 (diff)
downloadlinux-stable-4ecbac84b5b8c4ad033b473782582568810baf61.tar.gz
linux-stable-4ecbac84b5b8c4ad033b473782582568810baf61.tar.bz2
linux-stable-4ecbac84b5b8c4ad033b473782582568810baf61.zip
xfrm: Support crypto offload for inbound IPv4 UDP-encapsulated ESP packet
If xfrm_input() is called with UDP_ENCAP_ESPINUDP, the packet is already processed in UDP layer that removes the UDP header. Therefore, there should be no much difference to treat it as an ESP packet in the XFRM stack. Test: Enabled dir=in IPsec crypto offload, and verified IPv4 UDP-encapsulated ESP packets on both wifi/cellular network Signed-off-by: Mike Yu <yumike@google.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/xfrm')
-rw-r--r--net/xfrm/xfrm_input.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index ba8deb0235ba..7cee9c0a2cdc 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -471,7 +471,8 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
struct xfrm_offload *xo = xfrm_offload(skb);
struct sec_path *sp;
- if (encap_type < 0 || (xo && (xo->flags & XFRM_GRO || encap_type == 0))) {
+ if (encap_type < 0 || (xo && (xo->flags & XFRM_GRO || encap_type == 0 ||
+ encap_type == UDP_ENCAP_ESPINUDP))) {
x = xfrm_input_state(skb);
if (unlikely(x->dir && x->dir != XFRM_SA_DIR_IN)) {