naccyde / rpms / iproute

Forked from rpms/iproute 9 months ago
Clone

Blame SOURCES/0054-ip-link-Fix-listing-of-alias-interfaces.patch

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