* [PATCH iproute2 net-next] add support for table name in SRv6 End.DT* behaviors
@ 2019-12-06 18:11 Paolo Lungaroni
2019-12-11 17:23 ` David Ahern
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Lungaroni @ 2019-12-06 18:11 UTC (permalink / raw)
To: netdev; +Cc: Paolo Lungaroni
it allows to specify also the table name in addition to the table number in
SRv6 End.DT* behaviors.
To add an End.DT6 behavior route specifying the table by name:
$ ip -6 route add 2001:db8::1 encap seg6local action End.DT6 table main dev eth0
The ip route show to print output this route:
$ ip -6 route show 2001:db8::1
2001:db8::1 encap seg6local action End.DT6 table main dev eth0 metric 1024 pref medium
The JSON output:
$ ip -6 -j -p route show 2001:db8::1
[ {
"dst": "2001:db8::1",
"encap": "seg6local",
"action": "End.DT6",
"table": "main",
"dev": "eth0",
"metric": 1024,
"flags": [ ],
"pref": "medium"
} ]
Signed-off-by: Paolo Lungaroni <paolo.lungaroni@cnit.it>
---
ip/iproute_lwtunnel.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
index 03217b8f..cc60a022 100644
--- a/ip/iproute_lwtunnel.c
+++ b/ip/iproute_lwtunnel.c
@@ -229,6 +229,8 @@ static void print_encap_seg6local(FILE *fp, struct rtattr *encap)
struct rtattr *tb[SEG6_LOCAL_MAX + 1];
int action;
+ SPRINT_BUF(b1);
+
parse_rtattr_nested(tb, SEG6_LOCAL_MAX, encap);
if (!tb[SEG6_LOCAL_ACTION])
@@ -246,8 +248,9 @@ static void print_encap_seg6local(FILE *fp, struct rtattr *encap)
}
if (tb[SEG6_LOCAL_TABLE])
- print_uint(PRINT_ANY, "table",
- "table %u ", rta_getattr_u32(tb[SEG6_LOCAL_TABLE]));
+ print_string(PRINT_ANY, "table", "table %s ",
+ rtnl_rttable_n2a(rta_getattr_u32(tb[SEG6_LOCAL_TABLE]),
+ b1, sizeof(b1)));
if (tb[SEG6_LOCAL_NH4]) {
print_string(PRINT_ANY, "nh4",
@@ -654,7 +657,7 @@ static int parse_encap_seg6local(struct rtattr *rta, size_t len, int *argcp,
NEXT_ARG();
if (table_ok++)
duparg2("table", *argv);
- get_u32(&table, *argv, 0);
+ rtnl_rttable_a2n(&table, *argv);
ret = rta_addattr32(rta, len, SEG6_LOCAL_TABLE, table);
} else if (strcmp(*argv, "nh4") == 0) {
NEXT_ARG();
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH iproute2 net-next] add support for table name in SRv6 End.DT* behaviors
2019-12-06 18:11 [PATCH iproute2 net-next] add support for table name in SRv6 End.DT* behaviors Paolo Lungaroni
@ 2019-12-11 17:23 ` David Ahern
0 siblings, 0 replies; 2+ messages in thread
From: David Ahern @ 2019-12-11 17:23 UTC (permalink / raw)
To: Paolo Lungaroni, netdev
On 12/6/19 11:11 AM, Paolo Lungaroni wrote:
> it allows to specify also the table name in addition to the table number in
> SRv6 End.DT* behaviors.
>
> To add an End.DT6 behavior route specifying the table by name:
>
> $ ip -6 route add 2001:db8::1 encap seg6local action End.DT6 table main dev eth0
>
> The ip route show to print output this route:
>
> $ ip -6 route show 2001:db8::1
> 2001:db8::1 encap seg6local action End.DT6 table main dev eth0 metric 1024 pref medium
>
> The JSON output:
> $ ip -6 -j -p route show 2001:db8::1
> [ {
> "dst": "2001:db8::1",
> "encap": "seg6local",
> "action": "End.DT6",
> "table": "main",
> "dev": "eth0",
> "metric": 1024,
> "flags": [ ],
> "pref": "medium"
> } ]
>
> Signed-off-by: Paolo Lungaroni <paolo.lungaroni@cnit.it>
> ---
> ip/iproute_lwtunnel.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
applied to iproute2-next. Thanks
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-11 17:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-06 18:11 [PATCH iproute2 net-next] add support for table name in SRv6 End.DT* behaviors Paolo Lungaroni
2019-12-11 17:23 ` David Ahern
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.