From: Yuya Kusakabe <yuya.kusakabe@gmail.com>
To: dsahern@kernel.org
Cc: Yuya Kusakabe <yuya.kusakabe@gmail.com>, netdev@vger.kernel.org
Subject: [PATCH iproute2-next v2 6/6] seg6: add support for the H.M.GTP4.D behavior
Date: Tue, 05 May 2026 01:10:46 +0900 [thread overview]
Message-ID: <20260505-seg6-mobile-v2-6-93291b7b0134@gmail.com> (raw)
In-Reply-To: <20260505-seg6-mobile-v2-0-93291b7b0134@gmail.com>
Add support for the H.M.GTP4.D headend behavior, which translates
IPv4/GTP-U traffic into an SRv6 SR Policy. H.M.GTP4.D is installed
on an IPv4 route and reuses the existing src, v4_mask_len,
sr_prefix_len, and v6_src_prefix_len keywords.
The kernel validates that sr_prefix_len + v4_mask_len does not
exceed 88 bits and returns EINVAL via netlink extack otherwise,
since the locator, the embedded IPv4 destination, and the 40-bit
Args.Mob.Session field together must fit inside the 128-bit egress
SID.
Example:
ip -4 r a 10.0.0.0/24 encap seg6local action H.M.GTP4.D \
nh6 2001:db8:f:: src 2001:db8::1 \
v4_mask_len 32 sr_prefix_len 56 v6_src_prefix_len 64 dev sr0
Link: https://datatracker.ietf.org/doc/html/rfc9433
Signed-off-by: Yuya Kusakabe <yuya.kusakabe@gmail.com>
---
include/uapi/linux/seg6_local.h | 2 ++
ip/iproute.c | 2 +-
ip/iproute_lwtunnel.c | 1 +
man/man8/ip-route.8.in | 45 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/include/uapi/linux/seg6_local.h b/include/uapi/linux/seg6_local.h
index 0ca8405df2f2..69a875fcad73 100644
--- a/include/uapi/linux/seg6_local.h
+++ b/include/uapi/linux/seg6_local.h
@@ -82,6 +82,8 @@ enum {
SEG6_LOCAL_ACTION_END_M_GTP6_D = 20,
/* IPv6/GTP-U decap into SRv6, drop-in mode (RFC 9433 Section 6.4) */
SEG6_LOCAL_ACTION_END_M_GTP6_D_DI = 21,
+ /* SR headend: IPv4/GTP-U decap, encap in SRv6 (RFC 9433 Section 6.7) */
+ SEG6_LOCAL_ACTION_H_M_GTP4_D = 22,
__SEG6_LOCAL_ACTION_MAX,
};
diff --git a/ip/iproute.c b/ip/iproute.c
index 40494ccf8eaa..d956b39a8ef8 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -107,7 +107,7 @@ static void usage(void)
" End.DT6 | End.DT4 | End.DT46 | End.B6 | End.B6.Encaps |\n"
" End.BM | End.S | End.AS | End.AM | End.BPF |\n"
" End.MAP | End.M.GTP4.E | End.M.GTP6.E |\n"
- " End.M.GTP6.D | End.M.GTP6.D.Di }\n"
+ " End.M.GTP6.D | End.M.GTP6.D.Di | H.M.GTP4.D }\n"
"OPTIONS := OPTION [ OPTIONS ]\n"
"OPTION := { flavors FLAVORS | srh SEG6HDR | nh4 ADDR | nh6 ADDR | iif DEV | oif DEV |\n"
" table TABLEID | vrftable TABLEID | endpoint PROGNAME | MOBILE_OPTION }\n"
diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
index 570d95780ae4..0bb29e69dc52 100644
--- a/ip/iproute_lwtunnel.c
+++ b/ip/iproute_lwtunnel.c
@@ -410,6 +410,7 @@ static const char *seg6_action_names[SEG6_LOCAL_ACTION_MAX + 1] = {
[SEG6_LOCAL_ACTION_END_M_GTP6_E] = "End.M.GTP6.E",
[SEG6_LOCAL_ACTION_END_M_GTP6_D] = "End.M.GTP6.D",
[SEG6_LOCAL_ACTION_END_M_GTP6_D_DI] = "End.M.GTP6.D.Di",
+ [SEG6_LOCAL_ACTION_H_M_GTP4_D] = "H.M.GTP4.D",
};
static const char *format_action_type(int action)
diff --git a/man/man8/ip-route.8.in b/man/man8/ip-route.8.in
index 0487338707c6..7badfcc1e8c3 100644
--- a/man/man8/ip-route.8.in
+++ b/man/man8/ip-route.8.in
@@ -1133,6 +1133,51 @@ is rejected for this action: the original outer destination is
preserved verbatim instead of being repacked with an Args.Mob.Session
field, so no locator length needs to be carried.
+.B H.M.GTP4.D nh6
+.IR ADDRESS
+.B src
+.IR ADDRESS
+.B v4_mask_len
+.IR BITS
+.B sr_prefix_len
+.IR BITS
+.RB [ "v6_src_prefix_len"
+.IR BITS ]
+- SRv6 Mobile User Plane H.M.GTP4.D headend behavior (RFC 9433 Section
+6.7). Match an IPv4/UDP/GTP-U packet, strip the GTP-U envelope, and
+re-encapsulate the inner T-PDU in a new IPv6 header whose addresses
+encode the per-session identifiers expected by an
+.B End.M.GTP4.E
+SID at the egress SR gateway. The destination UPF prefix template is
+specified by
+.BR nh6 ,
+the source UPF prefix template by
+.BR src ;
+.B v4_mask_len
+is the bit length reserved for the original IPv4 destination/source
+address, and
+.B sr_prefix_len
+is the locator length of the egress End.M.GTP4.E SID (1..88).
+The 40-bit Args.Mob.Session field defined
+by RFC 9433 Section 6.1 follows the embedded IPv4 destination at the
+offset implied by
+.BR sr_prefix_len " + " v4_mask_len ;
+its width is fixed by the RFC and is not exposed as a knob.
+.BR sr_prefix_len " + " v4_mask_len
+must therefore be at most 88 bits so the resulting 128-bit SID can
+hold all three fields.
+.B v6_src_prefix_len
+controls the IPv6 SA layout per RFC 9433 Section 6.6 Figure 10
+(\fIP\fR | IPv4 SA | padding) in the same way as for End.M.GTP4.E:
+1..127, and
+.BR v6_src_prefix_len " + " v4_mask_len " <= 128" ;
+defaults to 64 when omitted.
+.PP
+.B Note:
+because H.M.GTP4.D matches IPv4/GTP-U packets, the route must be
+installed on the IPv4 FIB (\fBip -4 route add ...\fR); installing it
+under \fBip -6 route\fR is rejected by the kernel.
+
.B Flavors parameters
The flavors represent additional operations that can modify or extend a
--
2.50.1
prev parent reply other threads:[~2026-05-04 16:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-04 16:10 [PATCH iproute2-next v2 0/6] seg6: SRv6 Mobile User Plane (RFC 9433) Yuya Kusakabe
2026-05-04 16:10 ` [PATCH iproute2-next v2 1/6] seg6: add support for the End.MAP behavior Yuya Kusakabe
2026-05-04 16:10 ` [PATCH iproute2-next v2 2/6] seg6: add support for the End.M.GTP4.E behavior Yuya Kusakabe
2026-05-04 16:10 ` [PATCH iproute2-next v2 3/6] seg6: add support for the End.M.GTP6.E behavior Yuya Kusakabe
2026-05-04 16:10 ` [PATCH iproute2-next v2 4/6] seg6: add support for the End.M.GTP6.D behavior Yuya Kusakabe
2026-05-04 16:10 ` [PATCH iproute2-next v2 5/6] seg6: add support for the End.M.GTP6.D.Di behavior Yuya Kusakabe
2026-05-04 16:10 ` Yuya Kusakabe [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260505-seg6-mobile-v2-6-93291b7b0134@gmail.com \
--to=yuya.kusakabe@gmail.com \
--cc=dsahern@kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox