naccyde / rpms / iproute

Forked from rpms/iproute 9 months ago
Clone

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

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