Skip to content

xfrm: Fix bugs in stacked XFRM-I tunnels

Benedict Wong netdev 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 5 repliesIn review
  2. v12 patches 3 repliesSuperseded

Changes in v2 from the cover letter

- Reordered and rescoped patches to make changes clearer; policy check in xfrm_input necessary due to the incremental-verification process.
- Code style updates to conform with networking code formatting
- No net functional changes across both patches.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2xfrm: Skip checking of already-verified secpath entriesinclude/net/xfrm.h net/xfrm/xfrm_input.c net/xfrm/xfrm_policy.c+14 -10 replies
2/2xfrm: Ensure policy checked for nested ESP tunnelsnet/xfrm/xfrm_input.c+14 -05 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 ipsec 0/2] xfrm: Fix bugs in stacked XFRM-I tunnels

This patch set fixes bugs that prevent stacked IPsec tunnels (via XFRM interfaces) from receiving packets properly. The apparent cause of the issues is that the inner tunnel’s policy checks fail to validate the outer tunnel’s secpath entries (since it no longer has a reference to the outer tunnel policies, and each call validates ALL secpath entries) before verifying the inner tunnel’s. This fixes this by caching the list of verified secpath entries, and skipping them upon future validation runs.

PATCH 1/2 Makes template matching for previously verified entries in the secpath an optional match. This ensures that lost context for previous tunnel secpath entries does not trigger a template mismatch if it was previously verified. This allows each tunnel layer to incrementally verify only the secpath entries associated with it.

PATCH 2/2 Ensures that policies for nested tunnel mode transforms are verified (and marked as such) before additional decapsulation. This ensures that entries in the secpath are verified while the context (intermediate IP addresses, marks, etc) can be appropriately matched. Notably, unencapsulated ESP did not perform policy checks before handing to the next protocol for processing.

v1 -> v2:
- Reordered and rescoped patches to make changes clearer; policy check in xfrm_input necessary due to the incremental-verification process.
- Code style updates to conform with networking code formatting
- No net functional changes across both patches.