]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ip: route: Add IPv6 flow label support
authorIdo Schimmel <idosch@nvidia.com>
Mon, 30 Dec 2024 08:58:09 +0000 (10:58 +0200)
committerDavid Ahern <dsahern@kernel.org>
Wed, 1 Jan 2025 01:19:43 +0000 (01:19 +0000)
Allow specifying an IPv6 flow label when performing a route lookup.

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
ip/iproute.c
man/man8/ip-route.8.in

index 9520729e58eb1b91eb7dd3044fd40abc4f1eb43d..e1fe26ce05d03cbf0e3d687de873809b95f8a50d 100644 (file)
@@ -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;
 
index 676f289a6d26af1d5599bf165b4911a48219fd06..69d445ef8b5ca2c8a9274b9f0fc19fa6f4a4a1d2 100644 (file)
@@ -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" .