From: Ansuel Smith <ansuelsmth@gmail.com>
To: netdev@vger.kernel.org
Cc: "Marek Behún" <marek.behun@nic.cz>,
"David Ahern" <dsahern@gmail.com>,
"Stephen Hemminger" <stephen@networkplumber.org>,
"David S. Miller" <davem@davemloft.net>,
"Jakub Kicinski" <kuba@kernel.org>,
"Andrew Lunn" <andrew@lunn.ch>,
"Vivien Didelot" <vivien.didelot@gmail.com>,
"Florian Fainelli" <f.fainelli@gmail.com>,
"Vladimir Oltean" <olteanv@gmail.com>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andriin@fb.com>,
"Eric Dumazet" <edumazet@google.com>,
"Wei Wang" <weiwan@google.com>,
"Cong Wang" <cong.wang@bytedance.com>,
"Taehee Yoo" <ap420073@gmail.com>,
"Björn Töpel" <bjorn@kernel.org>, "Di Zhu" <zhudi21@huawei.com>,
"Weilong Chen" <chenweilong@huawei.com>,
"Nikolay Aleksandrov" <nikolay@nvidia.com>,
"Colin Ian King" <colin.king@canonical.com>,
"Roopa Prabhu" <roopa@cumulusnetworks.com>,
"Francis Laniel" <laniel_francis@privacyrequired.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH RFC iproute2-next] iplink: allow to change iplink value
Date: Sat, 10 Apr 2021 15:34:50 +0200 [thread overview]
Message-ID: <20210410133454.4768-5-ansuelsmth@gmail.com> (raw)
In-Reply-To: <20210410133454.4768-1-ansuelsmth@gmail.com>
Allow to change the interface to which a given interface is linked to.
This is useful in the case of multi-CPU port DSA, for changing the CPU
port of a given user port.
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: David Ahern <dsahern@gmail.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
---
ip/iplink.c | 16 +++++-----------
man/man8/ip-link.8.in | 7 +++++++
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/ip/iplink.c b/ip/iplink.c
index 212a0885..d52c0aaf 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -579,7 +579,6 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type)
{
char *name = NULL;
char *dev = NULL;
- char *link = NULL;
int ret, len;
char abuf[32];
int qlen = -1;
@@ -590,6 +589,7 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type)
int numrxqueues = -1;
int link_netnsid = -1;
int index = 0;
+ int link = -1;
int group = -1;
int addr_len = 0;
@@ -620,7 +620,10 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type)
invarg("Invalid \"index\" value", *argv);
} else if (matches(*argv, "link") == 0) {
NEXT_ARG();
- link = *argv;
+ link = ll_name_to_index(*argv);
+ if (!link)
+ return nodev(*argv);
+ addattr32(&req->n, sizeof(*req), IFLA_LINK, link);
} else if (matches(*argv, "address") == 0) {
NEXT_ARG();
addr_len = ll_addr_a2n(abuf, sizeof(abuf), *argv);
@@ -1004,15 +1007,6 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type)
exit(-1);
}
- if (link) {
- int ifindex;
-
- ifindex = ll_name_to_index(link);
- if (!ifindex)
- return nodev(link);
- addattr32(&req->n, sizeof(*req), IFLA_LINK, ifindex);
- }
-
req->i.ifi_index = index;
}
diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in
index a8ae72d2..800aed05 100644
--- a/man/man8/ip-link.8.in
+++ b/man/man8/ip-link.8.in
@@ -149,6 +149,9 @@ ip-link \- network device configuration
.br
.RB "[ " nomaster " ]"
.br
+.RB "[ " link
+.IR DEVICE " ]"
+.br
.RB "[ " vrf
.IR NAME " ]"
.br
@@ -2131,6 +2134,10 @@ set master device of the device (enslave device).
.BI nomaster
unset master device of the device (release device).
+.TP
+.BI link " DEVICE"
+set device to which this device is linked to.
+
.TP
.BI addrgenmode " eui64|none|stable_secret|random"
set the IPv6 address generation mode
--
2.21.0
next prev parent reply other threads:[~2021-04-11 15:04 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-10 13:34 [PATCH RFC net-next 0/3] Multi-CPU DSA support Ansuel Smith
2021-04-10 13:34 ` [PATCH RFC net-next 1/3] net: dsa: allow for multiple CPU ports Ansuel Smith
2021-04-12 3:35 ` DENG Qingfang
2021-04-12 4:41 ` Ansuel Smith
2021-04-12 15:30 ` DENG Qingfang
2021-04-12 16:17 ` Frank Wunderlich
2021-04-10 13:34 ` [PATCH RFC net-next 2/3] net: add ndo for setting the iflink property Ansuel Smith
2021-04-10 13:34 ` [PATCH RFC net-next 3/3] net: dsa: implement ndo_set_netlink for chaning port's CPU port Ansuel Smith
2021-04-10 13:34 ` Ansuel Smith [this message]
2021-04-11 17:04 ` [PATCH RFC iproute2-next] iplink: allow to change iplink value Stephen Hemminger
2021-04-11 17:09 ` Vladimir Oltean
2021-04-11 18:01 ` [PATCH RFC net-next 0/3] Multi-CPU DSA support Marek Behun
2021-04-11 18:08 ` Ansuel Smith
2021-04-11 18:39 ` Andrew Lunn
2021-04-12 2:07 ` Florian Fainelli
2021-04-12 4:53 ` Ansuel Smith
2021-04-11 18:50 ` Vladimir Oltean
2021-04-11 23:53 ` Vladimir Oltean
2021-04-12 2:10 ` Florian Fainelli
2021-04-12 5:04 ` Ansuel Smith
2021-04-12 12:46 ` Tobias Waldekranz
2021-04-12 14:35 ` Vladimir Oltean
2021-04-12 21:06 ` Tobias Waldekranz
2021-04-12 19:30 ` Marek Behun
2021-04-12 21:22 ` Tobias Waldekranz
2021-04-12 21:34 ` Vladimir Oltean
2021-04-12 21:49 ` Tobias Waldekranz
2021-04-12 21:56 ` Marek Behun
2021-04-12 22:06 ` Vladimir Oltean
2021-04-12 22:26 ` Tobias Waldekranz
2021-04-12 22:48 ` Vladimir Oltean
2021-04-12 23:04 ` Marek Behun
2021-04-12 21:50 ` Marek Behun
2021-04-12 22:05 ` Tobias Waldekranz
2021-04-12 22:55 ` Marek Behun
2021-04-12 23:09 ` Tobias Waldekranz
2021-04-12 23:13 ` Tobias Waldekranz
2021-04-12 23:54 ` Marek Behun
2021-04-13 0:27 ` Marek Behun
2021-04-13 0:31 ` Marek Behun
2021-04-13 14:46 ` Tobias Waldekranz
2021-04-13 15:14 ` Marek Behun
2021-04-13 18:16 ` Tobias Waldekranz
2021-04-14 15:14 ` Marek Behun
2021-04-14 18:39 ` Tobias Waldekranz
2021-04-14 23:39 ` Vladimir Oltean
2021-04-15 9:20 ` Tobias Waldekranz
2021-04-13 14:40 ` Tobias Waldekranz
2021-04-12 15:00 ` DENG Qingfang
2021-04-12 16:32 ` Vladimir Oltean
2021-04-12 22:04 ` Marek Behun
2021-04-12 22:17 ` Vladimir Oltean
2021-04-12 22:47 ` Marek Behun
-- strict thread matches above, loose matches on Subject: below --
2019-08-24 2:42 Marek Behún
2019-08-24 2:42 ` [PATCH RFC iproute2-next] iplink: allow to change iplink value Marek Behún
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=20210410133454.4768-5-ansuelsmth@gmail.com \
--to=ansuelsmth@gmail.com \
--cc=andrew@lunn.ch \
--cc=andriin@fb.com \
--cc=ap420073@gmail.com \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=chenweilong@huawei.com \
--cc=colin.king@canonical.com \
--cc=cong.wang@bytedance.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=laniel_francis@privacyrequired.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marek.behun@nic.cz \
--cc=netdev@vger.kernel.org \
--cc=nikolay@nvidia.com \
--cc=olteanv@gmail.com \
--cc=roopa@cumulusnetworks.com \
--cc=stephen@networkplumber.org \
--cc=vivien.didelot@gmail.com \
--cc=weiwan@google.com \
--cc=zhudi21@huawei.com \
/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).