|
|
318a74 |
From eb3be709aece2325f7eafc113120cf5ef8f077de Mon Sep 17 00:00:00 2001
|
|
|
318a74 |
From: Phil Sutter <psutter@redhat.com>
|
|
|
318a74 |
Date: Mon, 11 Mar 2019 16:28:41 +0100
|
|
|
318a74 |
Subject: [PATCH] ip-link: Fix listing of alias interfaces
|
|
|
318a74 |
|
|
|
318a74 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1673226
|
|
|
318a74 |
Upstream Status: RHEL-only
|
|
|
318a74 |
Conflicts: Context change due to missing commit 260137e24d3b7
|
|
|
318a74 |
("iplink: Remove flags argument from iplink_get")
|
|
|
318a74 |
|
|
|
318a74 |
Upstream rejected this patch as the alias notation is neither required
|
|
|
318a74 |
nor wanted by iproute2[1]. With iproute rebase in RHEL7.5 though, we
|
|
|
318a74 |
changed existing behaviour by accident. Therefore we will carry this
|
|
|
318a74 |
patch for RHEL7 lifetime.
|
|
|
318a74 |
|
|
|
318a74 |
[1] https://marc.info/?l=linux-netdev&m=154964861913609&w=2
|
|
|
318a74 |
|
|
|
318a74 |
commit a1259acb3c2037f464e31fad1f21556f8bf58c91
|
|
|
318a74 |
Author: Phil Sutter <phil@nwl.cc>
|
|
|
318a74 |
Date: Thu Feb 7 10:18:16 2019 +0100
|
|
|
318a74 |
|
|
|
318a74 |
ip-link: Fix listing of alias interfaces
|
|
|
318a74 |
|
|
|
318a74 |
Commit 50b9950dd9011 ("link dump filter") accidentally broke listing of
|
|
|
318a74 |
links in the old alias interface notation:
|
|
|
318a74 |
|
|
|
318a74 |
| % ip link show eth0:1
|
|
|
318a74 |
| RTNETLINK answers: No such device
|
|
|
318a74 |
| Cannot send link get request: No such device
|
|
|
318a74 |
|
|
|
318a74 |
Prior to the above commit, link lookup was performed via ifindex
|
|
|
318a74 |
returned by if_nametoindex(). The latter uses SIOCGIFINDEX ioctl call
|
|
|
318a74 |
which on kernel side causes the colon-suffix to be dropped before doing
|
|
|
318a74 |
the interface lookup. Netlink API though doesn't care about that at all.
|
|
|
318a74 |
To keep things backward compatible, mimick ioctl API behaviour and drop
|
|
|
318a74 |
the colon-suffix prior to sending the RTM_GETLINK request.
|
|
|
318a74 |
|
|
|
318a74 |
Fixes: 50b9950dd9011 ("link dump filter")
|
|
|
318a74 |
---
|
|
|
318a74 |
ip/ipaddress.c | 1 +
|
|
|
318a74 |
1 file changed, 1 insertion(+)
|
|
|
318a74 |
|
|
|
318a74 |
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
|
|
|
d30c09 |
index 7492075687a9e..14e9e224dfa87 100644
|
|
|
318a74 |
--- a/ip/ipaddress.c
|
|
|
318a74 |
+++ b/ip/ipaddress.c
|
|
|
318a74 |
@@ -1707,6 +1707,7 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action)
|
|
|
318a74 |
* the link device
|
|
|
318a74 |
*/
|
|
|
318a74 |
if (filter_dev && filter.group == -1 && do_link == 1) {
|
|
|
318a74 |
+ *strchrnul(filter_dev, ':') = '\0';
|
|
|
318a74 |
if (iplink_get(0, filter_dev, RTEXT_FILTER_VF) < 0) {
|
|
|
318a74 |
perror("Cannot send link get request");
|
|
|
318a74 |
exit(1);
|
|
|
318a74 |
--
|
|
|
d30c09 |
2.21.0
|
|
|
318a74 |
|