* [PATCH iproute2-next 0/2] seg6: add support for lookup attribute in SRv6 encap routes
@ 2026-07-12 2:11 Andrea Mayer
2026-07-12 2:11 ` [PATCH iproute2-next 1/2] " Andrea Mayer
2026-07-12 2:11 ` [PATCH iproute2-next 2/2] seg6: man: document the lookup attribute for " Andrea Mayer
0 siblings, 2 replies; 5+ messages in thread
From: Andrea Mayer @ 2026-07-12 2:11 UTC (permalink / raw)
To: David Ahern, netdev
Cc: Stephen Hemminger, Nicolas Dichtel, Stefano Salsano,
Ahmed Abdelsalam, Paolo Lungaroni, Justin Iurman,
Anthony Doeraene, Andrea Mayer
This series adds the optional "lookup" attribute to seg6 encap routes.
It selects the FIB table used to look up the route for the first SID,
that is the outer IPv6 destination of the encapsulated packet. The
attribute accepts a table number or a table name.
Examples:
# SID route installed in the underlay table 500
ip -6 route add fc00::100/128 via fd00::1 dev veth0 table 500
# encap route in vrf-100; the first SID is looked up in table 500
ip -6 route add cafe::1/128 vrf vrf-100 \
encap seg6 mode encap segs fc00::100 lookup 500 dev veth0
# or if the SID is already handled by the main table
ip -6 route add cafe::1/128 vrf vrf-100 \
encap seg6 mode encap segs fc00::100 lookup main dev veth0
The kernel companion series, adding the SEG6_IPTUNNEL_TABLE attribute, is
posted for net-next:
https://lore.kernel.org/all/20260711162907.6521-1-andrea.mayer@uniroma2.it/T/
The first patch adds the attribute, the second documents it in the
ip-route man page.
Thanks,
Andrea
Andrea Mayer (2):
seg6: add support for lookup attribute in SRv6 encap routes
seg6: man: document the lookup attribute for SRv6 encap routes
ip/iproute.c | 1 +
ip/iproute_lwtunnel.c | 22 +++++++++++++++++++++-
man/man8/ip-route.8.in | 16 +++++++++++++++-
3 files changed, 37 insertions(+), 2 deletions(-)
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH iproute2-next 1/2] seg6: add support for lookup attribute in SRv6 encap routes
2026-07-12 2:11 [PATCH iproute2-next 0/2] seg6: add support for lookup attribute in SRv6 encap routes Andrea Mayer
@ 2026-07-12 2:11 ` Andrea Mayer
2026-07-16 9:48 ` Nicolas Dichtel
2026-07-12 2:11 ` [PATCH iproute2-next 2/2] seg6: man: document the lookup attribute for " Andrea Mayer
1 sibling, 1 reply; 5+ messages in thread
From: Andrea Mayer @ 2026-07-12 2:11 UTC (permalink / raw)
To: David Ahern, netdev
Cc: Stephen Hemminger, Nicolas Dichtel, Stefano Salsano,
Ahmed Abdelsalam, Paolo Lungaroni, Justin Iurman,
Anthony Doeraene, Andrea Mayer
Add support for the new optional "lookup" attribute for seg6 encap
routes. It selects the FIB table for the post-encap SID route lookup
and accepts a table number or a table name.
Examples:
# SID route installed in the underlay table 500
ip -6 route add fc00::100/128 via fd00::1 dev veth0 table 500
# encap route in vrf-100; the first SID is looked up in table 500
ip -6 route add cafe::1/128 vrf vrf-100 \
encap seg6 mode encap segs fc00::100 lookup 500 dev veth0
# or if the SID is already handled by the main table
ip -6 route add cafe::1/128 vrf vrf-100 \
encap seg6 mode encap segs fc00::100 lookup main dev veth0
When the attribute is omitted, the post-encap SID route lookup behaves
as before, using the current routing context (e.g. the tables selected
according to the routing policy database).
Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
---
ip/iproute.c | 1 +
ip/iproute_lwtunnel.c | 22 +++++++++++++++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/ip/iproute.c b/ip/iproute.c
index 5b9e7ac1..1ce71f78 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -101,6 +101,7 @@ static void usage(void)
"ENCAPTYPE := [ mpls | ip | ip6 | seg6 | seg6local | rpl | ioam6 | xfrm ]\n"
"ENCAPHDR := [ MPLSLABEL | SEG6HDR | SEG6LOCAL | IOAM6HDR | XFRMINFO ]\n"
"SEG6HDR := [ mode SEGMODE ] segs ADDR1,ADDRi,ADDRn [hmac HMACKEYID] [cleanup]\n"
+ " [ lookup TABLEID ]\n"
"SEGMODE := [ encap | encap.red | inline | l2encap | l2encap.red ]\n"
"SEG6LOCAL := action ACTION [ OPTIONS ] [ count ]\n"
"ACTION := { End | End.X | End.T | End.DX2 | End.DX6 | End.DX4 |\n"
diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
index 00b4f756..9a1e747c 100644
--- a/ip/iproute_lwtunnel.c
+++ b/ip/iproute_lwtunnel.c
@@ -256,6 +256,7 @@ static void print_encap_seg6(FILE *fp, struct rtattr *encap)
{
struct rtattr *tb[SEG6_IPTUNNEL_MAX+1];
struct seg6_iptunnel_encap *tuninfo;
+ SPRINT_BUF(b1);
parse_rtattr_nested(tb, SEG6_IPTUNNEL_MAX, encap);
@@ -274,6 +275,12 @@ static void print_encap_seg6(FILE *fp, struct rtattr *encap)
}
print_srh(fp, tuninfo->srh);
+
+ if (tb[SEG6_IPTUNNEL_TABLE]) {
+ print_string(PRINT_ANY, "lookup", "lookup %s ",
+ rtnl_rttable_n2a(rta_getattr_u32(tb[SEG6_IPTUNNEL_TABLE]),
+ b1, sizeof(b1)));
+ }
}
static void print_rpl_srh(FILE *fp, struct ipv6_rpl_sr_hdr *srh)
@@ -955,7 +962,7 @@ static struct ipv6_sr_hdr *parse_srh(char *segbuf, int hmac, bool encap)
static int parse_encap_seg6(struct rtattr *rta, size_t len, int *argcp,
char ***argvp)
{
- int mode_ok = 0, segs_ok = 0, hmac_ok = 0;
+ int mode_ok = 0, segs_ok = 0, hmac_ok = 0, lookup_ok = 0;
struct seg6_iptunnel_encap *tuninfo = NULL;
struct ipv6_sr_hdr *srh;
char **argv = *argvp;
@@ -963,6 +970,7 @@ static int parse_encap_seg6(struct rtattr *rta, size_t len, int *argcp,
bool tunsrc = false;
inet_prefix saddr;
int argc = *argcp;
+ __u32 lookup = 0;
int encap = -1;
__u32 hmac = 0;
int ret = -1;
@@ -1006,6 +1014,13 @@ 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, "lookup") == 0) {
+ NEXT_ARG();
+ if (lookup_ok++)
+ duparg2("lookup", *argv);
+ /* note that table 0 is considered an invalid value */
+ if (rtnl_rttable_a2n(&lookup, *argv) || !lookup)
+ invarg("\"lookup\" value is invalid\n", *argv);
} else {
break;
}
@@ -1036,6 +1051,11 @@ static int parse_encap_seg6(struct rtattr *rta, size_t len, int *argcp,
goto out;
}
+ if (lookup) {
+ if (rta_addattr32(rta, len, SEG6_IPTUNNEL_TABLE, lookup))
+ goto out;
+ }
+
*argcp = argc + 1;
*argvp = argv - 1;
ret = 0;
--
2.20.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH iproute2-next 2/2] seg6: man: document the lookup attribute for SRv6 encap routes
2026-07-12 2:11 [PATCH iproute2-next 0/2] seg6: add support for lookup attribute in SRv6 encap routes Andrea Mayer
2026-07-12 2:11 ` [PATCH iproute2-next 1/2] " Andrea Mayer
@ 2026-07-12 2:11 ` Andrea Mayer
2026-07-16 9:49 ` Nicolas Dichtel
1 sibling, 1 reply; 5+ messages in thread
From: Andrea Mayer @ 2026-07-12 2:11 UTC (permalink / raw)
To: David Ahern, netdev
Cc: Stephen Hemminger, Nicolas Dichtel, Stefano Salsano,
Ahmed Abdelsalam, Paolo Lungaroni, Justin Iurman,
Anthony Doeraene, Andrea Mayer
Document the new optional "lookup" attribute for seg6 encap routes. It
selects the FIB table for the post-encap SID route lookup and accepts a
table number or a table name.
Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
---
man/man8/ip-route.8.in | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/man/man8/ip-route.8.in b/man/man8/ip-route.8.in
index 9f29fd43..fd04432f 100644
--- a/man/man8/ip-route.8.in
+++ b/man/man8/ip-route.8.in
@@ -246,7 +246,9 @@ throw " | " unreachable " | " prohibit " | " blackhole " | " nat " ]"
.B segs
.IR SEGMENTS " [ "
.B hmac
-.IR KEYID " ]"
+.IR KEYID " ] [ "
+.B lookup
+.IR TABLEID " ]"
.ti -8
.IR ENCAP_SEG6LOCAL " := "
@@ -910,6 +912,18 @@ configuration and dynamic resolution.
.I KEYID
- Numerical value in decimal representation. See \fBip-sr\fR(8).
+.sp
+
+.B lookup
+.I TABLEID
+- Table for the post-encap SID route lookup, i.e. looking up the
+route for the first SID.
+.I TABLEID
+is either a number or a string from
+.BR @SYSCONF_USR_DIR@/rt_tables " or " @SYSCONF_ETC_DIR@/rt_tables
+(has precedence if exists); table id 0 is not a valid value.
+When omitted, this lookup uses the current routing context, e.g. tables
+selected according to the routing policy database.
.in -2
.sp
--
2.20.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2-next 1/2] seg6: add support for lookup attribute in SRv6 encap routes
2026-07-12 2:11 ` [PATCH iproute2-next 1/2] " Andrea Mayer
@ 2026-07-16 9:48 ` Nicolas Dichtel
0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Dichtel @ 2026-07-16 9:48 UTC (permalink / raw)
To: Andrea Mayer, David Ahern, netdev
Cc: Stephen Hemminger, Stefano Salsano, Ahmed Abdelsalam,
Paolo Lungaroni, Justin Iurman, Anthony Doeraene
Le 12/07/2026 à 04:11, Andrea Mayer a écrit :
> Add support for the new optional "lookup" attribute for seg6 encap
> routes. It selects the FIB table for the post-encap SID route lookup
> and accepts a table number or a table name.
>
> Examples:
>
> # SID route installed in the underlay table 500
> ip -6 route add fc00::100/128 via fd00::1 dev veth0 table 500
>
> # encap route in vrf-100; the first SID is looked up in table 500
> ip -6 route add cafe::1/128 vrf vrf-100 \
> encap seg6 mode encap segs fc00::100 lookup 500 dev veth0
>
> # or if the SID is already handled by the main table
> ip -6 route add cafe::1/128 vrf vrf-100 \
> encap seg6 mode encap segs fc00::100 lookup main dev veth0
>
> When the attribute is omitted, the post-encap SID route lookup behaves
> as before, using the current routing context (e.g. the tables selected
> according to the routing policy database).
>
> Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
Reviewed-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2-next 2/2] seg6: man: document the lookup attribute for SRv6 encap routes
2026-07-12 2:11 ` [PATCH iproute2-next 2/2] seg6: man: document the lookup attribute for " Andrea Mayer
@ 2026-07-16 9:49 ` Nicolas Dichtel
0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Dichtel @ 2026-07-16 9:49 UTC (permalink / raw)
To: Andrea Mayer, David Ahern, netdev
Cc: Stephen Hemminger, Stefano Salsano, Ahmed Abdelsalam,
Paolo Lungaroni, Justin Iurman, Anthony Doeraene
Le 12/07/2026 à 04:11, Andrea Mayer a écrit :
> Document the new optional "lookup" attribute for seg6 encap routes. It
> selects the FIB table for the post-encap SID route lookup and accepts a
> table number or a table name.
>
> Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
Reviewed-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-07-16 9:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-12 2:11 [PATCH iproute2-next 0/2] seg6: add support for lookup attribute in SRv6 encap routes Andrea Mayer
2026-07-12 2:11 ` [PATCH iproute2-next 1/2] " Andrea Mayer
2026-07-16 9:48 ` Nicolas Dichtel
2026-07-12 2:11 ` [PATCH iproute2-next 2/2] seg6: man: document the lookup attribute for " Andrea Mayer
2026-07-16 9:49 ` Nicolas Dichtel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox