From: Ido Schimmel <idosch@nvidia.com>
To: <netdev@vger.kernel.org>
Cc: <dsahern@gmail.com>, <stephen@networkplumber.org>,
<petrm@nvidia.com>, <gnault@redhat.com>,
Ido Schimmel <idosch@nvidia.com>
Subject: [PATCH iproute2-next 2/3] ip: route: Add IPv6 flow label support
Date: Mon, 23 Dec 2024 10:26:41 +0200 [thread overview]
Message-ID: <20241223082642.48634-3-idosch@nvidia.com> (raw)
In-Reply-To: <20241223082642.48634-1-idosch@nvidia.com>
Allow specifying an IPv6 flow label when performing a route lookup.
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
ip/iproute.c | 10 +++++++++-
man/man8/ip-route.8.in | 8 +++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/ip/iproute.c b/ip/iproute.c
index 9520729e58eb..e87faecdb714 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\n", *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" .
--
2.47.1
next prev parent reply other threads:[~2024-12-23 8:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-23 8:26 [PATCH iproute2-next 0/3] Add flow label support to ip-rule and route get Ido Schimmel
2024-12-23 8:26 ` [PATCH iproute2-next 1/3] Sync uAPI headers Ido Schimmel
2024-12-23 8:26 ` Ido Schimmel [this message]
2024-12-23 8:26 ` [PATCH iproute2-next 3/3] iprule: Add flow label support Ido Schimmel
2024-12-24 19:34 ` Stephen Hemminger
2024-12-23 14:59 ` [PATCH iproute2-next 0/3] Add flow label support to ip-rule and route get Guillaume Nault
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241223082642.48634-3-idosch@nvidia.com \
--to=idosch@nvidia.com \
--cc=dsahern@gmail.com \
--cc=gnault@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=petrm@nvidia.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).