[PATCH net v2 0/3] net: ioam6: makes IOAM insertion transparent to IPv6 ECMP

From: Hangbin Liu

Date: Tue Nov 03 2026 - 04:30:30 EST


This series makes IOAM insertion transparent to IPv6 ECMP, as required
by RFC 9486 (C2): a packet carrying IOAM options must be forwarded
along the same path as the identical packet without them.

Patch 1 fixes the transit side: hash policy 0 hashed the raw IPv6
nexthdr, which becomes NEXTHDR_HOP once an IOAM Hop-by-Hop header is
inserted. The policy-0 key (and the ICMPv6-error flow selection) now
uses the nexthdr the packet would have had if the Hop-by-Hop header
carried only IOAM options and padding.

Patch 2 fixes the injecting node: on an ioam6 output destination-cache
miss, inline mode now reuses orig_dst so the ECMP sibling from the
original socket lookup is kept (the destination does not change).
Encapsulation may switch the destination to tundst, so it still
re-looks up the transformed packet, using the Hop-by-Hop nexthdr for
flowi6_proto (IPPROTO_IPV6 after encap) and precomputing fl6.mp_hash
from the packet so ICMPv6 quoted-flow and L4 keys are not lost when
ip6_route_output() runs with no skb.

Patch 3 adds selftests/net/ioam6_ecmp.sh, covering both places: a
transit forwarder with a multipath route, and an encapsulating node
compared against a plain ip6ip6 baseline.

The issue was found while reviewing RFC9486. It can be reproduced and
verified by the newly added ioam6_ecmp.sh test.

Tested with:
ecmp_rehash.sh
fib_nexthops.sh
ioam6_ecmp.sh
tcp_ecmp_failover.sh
forwarding/gre_inner_v4_multipath.sh
forwarding/gre_inner_v6_multipath.sh
forwarding/gre_multipath_nh_res.sh
forwarding/gre_multipath_nh.sh
forwarding/gre_multipath.sh
forwarding/ip6gre_inner_v4_multipath.sh
forwarding/ip6gre_inner_v6_multipath.sh
forwarding/router_mpath_nh_res.sh
forwarding/router_mpath_nh.sh
forwarding/router_multipath.sh

---
Changes in v2:
- patch 01:
* use skb_network_offset() as the start of offset.
* try get inner next header for ICMPv6 errors.
- patch 02:
* use origin dst for inline mode, as dst is not changed.
* use HBH nexthdr for encap mode, as dst may change to tundst.
- patch 03:
* remove `-w` to prevent ping from ignoring `-c` and continuing to send
packets before receiving replies.
* remove beta_tnl warm up since the tunnel will be re-create every time.
* move trap cleanup before setup
* update some comments
* remove tunsrc in ioam encap setup
- Link to v1: https://patch.msgid.link/20261028-ipv6_ioam_ecmp-v1-0-9b6715b6f4c0@xxxxxxxxxx

---
Hangbin Liu (3):
ipv6: route: consider IOAM options in ECMP hash policy 0
ipv6: ioam6: use transformed packet nexthdr for ECMP re-lookup
selftests: net: add ioam6 ECMP test (RFC 9486 C2)

include/uapi/linux/in6.h | 1 +
net/ipv6/ioam6_iptunnel.c | 79 ++++---
net/ipv6/route.c | 95 +++++++-
tools/testing/selftests/net/Makefile | 1 +
tools/testing/selftests/net/config | 2 +
tools/testing/selftests/net/ioam6_ecmp.sh | 348 ++++++++++++++++++++++++++++++
6 files changed, 495 insertions(+), 31 deletions(-)
---
base-commit: c3e67bd82b9b9b1a5118f09a429ccefe2aab0741
change-id: 20261020-ipv6_ioam_ecmp-ae4ef0a4bdae

Best regards,
--
Hangbin Liu <liuhangbin@xxxxxxxxxx>