[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190207130527.9439-1-phil@nwl.cc>
Date: Thu, 7 Feb 2019 14:05:27 +0100
From: Phil Sutter <phil@....cc>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org, Roopa Prabhu <roopa@...ulusnetworks.com>
Subject: [iproute PATCH] ip-link: Fix listing of alias interfaces
Commit 50b9950dd9011 ("link dump filter") accidentally broke listing of
links in the old alias interface notation:
| % ip link show eth0:1
| RTNETLINK answers: No such device
| Cannot send link get request: No such device
Prior to the above commit, link lookup was performed via ifindex
returned by if_nametoindex(). The latter uses SIOCGIFINDEX ioctl call
which on kernel side causes the colon-suffix to be dropped before doing
the interface lookup. Netlink API though doesn't care about that at all.
To keep things backward compatible, mimick ioctl API behaviour and drop
the colon-suffix prior to sending the RTM_GETLINK request.
Fixes: 50b9950dd9011 ("link dump filter")
Signed-off-by: Phil Sutter <phil@....cc>
---
ip/ipaddress.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 2bc33f3a3b3f2..bc30d326ca0a3 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1974,6 +1974,7 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
* the link device
*/
if (filter_dev && filter.group == -1 && do_link == 1) {
+ *strchrnul(filter_dev, ':') = '\0';
if (iplink_get(filter_dev, RTEXT_FILTER_VF) < 0) {
perror("Cannot send link get request");
delete_json_obj();
--
2.20.1
Powered by blists - more mailing lists