Message ID | 20241230085810.87766-3-idosch@nvidia.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 35ae138e2c94597f6d9ff83ef7434112e8de22ef |
Delegated to: | David Ahern |
Headers | show |
Series | Add flow label support to ip-rule and route get | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
On Mon, 30 Dec 2024 10:58:09 +0200 Ido Schimmel <idosch@nvidia.com> wrote: > @@ -2129,6 +2129,14 @@ static int iproute_get(int argc, char **argv) > invarg("Invalid \"ipproto\" value\n", > *argv); > addattr8(&req.n, sizeof(req), RTA_IP_PROTO, ipproto); > + } else if (strcmp(*argv, "flowlabel") == 0) { > + __be32 flowlabel; > + > + NEXT_ARG(); > + if (get_be32(&flowlabel, *argv, 0)) > + invarg("invalid flowlabel", *argv); > + addattr32(&req.n, sizeof(req), RTA_FLOWLABEL, > + flowlabel); > } else { > inet_prefix addr; > What about displaying flow label with the ip route command?
On Mon, Dec 30, 2024 at 04:49:58PM -0800, Stephen Hemminger wrote: > On Mon, 30 Dec 2024 10:58:09 +0200 > Ido Schimmel <idosch@nvidia.com> wrote: > > > @@ -2129,6 +2129,14 @@ static int iproute_get(int argc, char **argv) > > invarg("Invalid \"ipproto\" value\n", > > *argv); > > addattr8(&req.n, sizeof(req), RTA_IP_PROTO, ipproto); > > + } else if (strcmp(*argv, "flowlabel") == 0) { > > + __be32 flowlabel; > > + > > + NEXT_ARG(); > > + if (get_be32(&flowlabel, *argv, 0)) > > + invarg("invalid flowlabel", *argv); > > + addattr32(&req.n, sizeof(req), RTA_FLOWLABEL, > > + flowlabel); > > } else { > > inet_prefix addr; > > > > What about displaying flow label with the ip route command? The flow label is not a route attribute and it is not present in RTM_NEWROUTE messages. It is provided as an input to the route lookup process in RTM_GETROUTE messages.
diff --git a/ip/iproute.c b/ip/iproute.c index 9520729e58eb..e1fe26ce05d0 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -67,7 +67,7 @@ static void usage(void) " [ mark NUMBER ] [ vrf NAME ]\n" " [ uid NUMBER ] [ ipproto PROTOCOL ]\n" " [ sport NUMBER ] [ dport NUMBER ]\n" - " [ as ADDRESS ]\n" + " [ as ADDRESS ] [ flowlabel FLOWLABEL ]\n" " ip route { add | del | change | append | replace } ROUTE\n" "SELECTOR := [ root PREFIX ] [ match PREFIX ] [ exact PREFIX ]\n" " [ table TABLE_ID ] [ vrf NAME ] [ proto RTPROTO ]\n" @@ -2129,6 +2129,14 @@ static int iproute_get(int argc, char **argv) invarg("Invalid \"ipproto\" value\n", *argv); addattr8(&req.n, sizeof(req), RTA_IP_PROTO, ipproto); + } else if (strcmp(*argv, "flowlabel") == 0) { + __be32 flowlabel; + + NEXT_ARG(); + if (get_be32(&flowlabel, *argv, 0)) + invarg("invalid flowlabel", *argv); + addattr32(&req.n, sizeof(req), RTA_FLOWLABEL, + flowlabel); } else { inet_prefix addr; diff --git a/man/man8/ip-route.8.in b/man/man8/ip-route.8.in index 676f289a6d26..69d445ef8b5c 100644 --- a/man/man8/ip-route.8.in +++ b/man/man8/ip-route.8.in @@ -47,7 +47,9 @@ ip-route \- routing table management .B dport .IR NUMBER " ] [" .B as -.IR ADDRESS " ]" +.IR ADDRESS " ] [" +.B flowlabel +.IR FLOWLABEL " ] .ti -8 .BR "ip route" " { " add " | " del " | " change " | " append " | "\ @@ -1316,6 +1318,10 @@ was given, relookup the route with the source set to the preferred address received from the first lookup. If policy routing is used, it may be a different route. +.TP +.BI flowlabel " FLOWLABEL" +ipv6 flow label as seen by the route lookup + .P Note that this operation is not equivalent to .BR "ip route show" .