[PATCH net v3 0/2] seg6: fix dst_cache sharing in seg6 lwtunnel

Andrea Mayer
2026-04-04T00:45:01Z

The seg6 lwtunnel encap uses a single per-route dst_cache shared
between seg6_input_core() and seg6_output_core(). These two paths
can perform the post-encap SID lookup in different routing contexts
(e.g., ip rules matching on the ingress interface, or VRF table
separation). Whichever path runs first populates the cache, and the
other reuses it blindly, bypassing its own lookup.

Patch 1 fixes this by splitting the cache into cache_input and
cache_output. Patch 2 adds a selftest that validates the isolation.

Changes v2 -> v3:
- Patch 2: add root privilege check (Justin)
- Patch 2: extend prerequisite tool checks and use ping instead
of ping6 for consistency with other srv6 selftests

Changes v1 -> v2:
- Patch 2: fix SKIP message wording (Nicolas)

Andrea Mayer (2):
seg6: separate dst_cache for input and output paths in seg6 lwtunnel
selftests: seg6: add test for dst_cache isolation in seg6 lwtunnel

net/ipv6/seg6_iptunnel.c | 34 ++-
tools/testing/selftests/net/Makefile | 1 +
.../selftests/net/srv6_iptunnel_cache.sh | 197 ++++++++++++++++++
3 files changed, 221 insertions(+), 11 deletions(-)
create mode 100755 tools/testing/selftests/net/srv6_iptunnel_cache.sh

--
2.43.0