* [RFC PATCH iproute2-next] seg6: add support of 'nh-vrf' flag
@ 2026-03-27 14:07 Nicolas Dichtel
0 siblings, 0 replies; only message in thread
From: Nicolas Dichtel @ 2026-03-27 14:07 UTC (permalink / raw)
To: David Ahern, Stephen Hemminger, David Lebrun, Andrea Mayer,
Paolo Lungaroni
Cc: netdev, Nicolas Dichtel
This new flag enables to have x-vrf routes.
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
A formal submission will be done once the kernel patch is merged.
include/uapi/linux/seg6_iptunnel.h | 2 ++
ip/iproute_lwtunnel.c | 10 ++++++++++
man/man8/ip-route.8.in | 9 ++++++++-
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/include/uapi/linux/seg6_iptunnel.h b/include/uapi/linux/seg6_iptunnel.h
index e1929d21c0b6..81e5c699d157 100644
--- a/include/uapi/linux/seg6_iptunnel.h
+++ b/include/uapi/linux/seg6_iptunnel.h
@@ -20,6 +20,8 @@
enum {
SEG6_IPTUNNEL_UNSPEC,
SEG6_IPTUNNEL_SRH,
+ SEG6_IPTUNNEL_SRC, /* struct in6_addr */
+ SEG6_IPTUNNEL_NH_VRF,
__SEG6_IPTUNNEL_MAX,
};
#define SEG6_IPTUNNEL_MAX (__SEG6_IPTUNNEL_MAX - 1)
diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
index a7885dba28c1..e6a61c0d5046 100644
--- a/ip/iproute_lwtunnel.c
+++ b/ip/iproute_lwtunnel.c
@@ -267,6 +267,9 @@ static void print_encap_seg6(FILE *fp, struct rtattr *encap)
"mode %s ", format_seg6mode_type(tuninfo->mode));
print_srh(fp, tuninfo->srh);
+
+ if (tb[SEG6_IPTUNNEL_NH_VRF])
+ print_string(PRINT_ANY, NULL, "%s ", "nh-vrf");
}
static void print_rpl_srh(FILE *fp, struct ipv6_rpl_sr_hdr *srh)
@@ -953,6 +956,7 @@ static int parse_encap_seg6(struct rtattr *rta, size_t len, int *argcp,
struct ipv6_sr_hdr *srh;
char **argv = *argvp;
char segbuf[1024] = "";
+ bool nh_vrf = false;
int argc = *argcp;
int encap = -1;
__u32 hmac = 0;
@@ -981,6 +985,8 @@ static int parse_encap_seg6(struct rtattr *rta, size_t len, int *argcp,
if (hmac_ok++)
duparg2("hmac", *argv);
get_u32(&hmac, *argv, 0);
+ } else if (strcmp(*argv, "nh-vrf") == 0) {
+ nh_vrf = true;
} else {
break;
}
@@ -1005,6 +1011,10 @@ static int parse_encap_seg6(struct rtattr *rta, size_t len, int *argcp,
sizeof(*tuninfo) + srhlen))
goto out;
+ if (nh_vrf &&
+ rta_addattr_l(rta, len, SEG6_IPTUNNEL_NH_VRF, NULL, 0))
+ goto out;
+
*argcp = argc + 1;
*argvp = argv - 1;
ret = 0;
diff --git a/man/man8/ip-route.8.in b/man/man8/ip-route.8.in
index aafa6d98a4c2..37dcaae49195 100644
--- a/man/man8/ip-route.8.in
+++ b/man/man8/ip-route.8.in
@@ -240,7 +240,9 @@ throw " | " unreachable " | " prohibit " | " blackhole " | " nat " ]"
.IR ENCAP_SEG6 " := "
.B seg6
.BR mode " [ "
-.BR encap " | " encap.red " | " inline " | " l2encap " | " l2encap.red " ] "
+.BR encap " | " encap.red " | " inline " | " l2encap " | " l2encap.red " ] ["
+.B nh-vrf
+.IR "]"
.B segs
.IR SEGMENTS " [ "
.B hmac
@@ -893,6 +895,11 @@ applying the reduced segment list. When there is only one segment
and the HMAC is not present, the SRH is omitted.
.sp
+.B nh-vrf
+- use the vrf attached to the next hop device to route the encapsulated
+packet.
+.sp
+
.I SEGMENTS
- List of comma-separated IPv6 addresses
.sp
--
2.52.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-03-27 14:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-27 14:07 [RFC PATCH iproute2-next] seg6: add support of 'nh-vrf' flag Nicolas Dichtel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox