mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:24:47 +01:00
xfrm: Prevent locally generated packets from direct output in tunnel mode
Add a check to ensure locally generated packets (skb->sk != NULL) do
not use direct output in tunnel mode, as these packets require proper
L2 header setup that is handled by the normal XFRM processing path.
Fixes: 5eddd76ec2 ("xfrm: fix tunnel mode TX datapath in packet offload mode")
Signed-off-by: Jianbo Liu <jianbol@nvidia.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
This commit is contained in:
parent
61fafbee6c
commit
59630e2ccd
1 changed files with 5 additions and 1 deletions
|
|
@ -772,8 +772,12 @@ int xfrm_output(struct sock *sk, struct sk_buff *skb)
|
|||
/* Exclusive direct xmit for tunnel mode, as
|
||||
* some filtering or matching rules may apply
|
||||
* in transport mode.
|
||||
* Locally generated packets also require
|
||||
* the normal XFRM path for L2 header setup,
|
||||
* as the hardware needs the L2 header to match
|
||||
* for encryption, so skip direct output as well.
|
||||
*/
|
||||
if (x->props.mode == XFRM_MODE_TUNNEL)
|
||||
if (x->props.mode == XFRM_MODE_TUNNEL && !skb->sk)
|
||||
return xfrm_dev_direct_output(sk, x, skb);
|
||||
|
||||
return xfrm_output_resume(sk, skb, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue