[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190207102438.21448-1-phil@nwl.cc>
Date: Thu, 7 Feb 2019 11:24:38 +0100
From: Phil Sutter <phil@....cc>
To: David Miller <davem@...emloft.net>
Cc: netdev@...r.kernel.org
Subject: [net-next PATCH] net: rtnetlink: Support alias interfaces with RTM_GETLINK
Align interface name handling regarding alias interfaces in
rtnl_getlink() with dev_ioctl() treating SIOCGIFINDEX ioctl calls. The
latter function strips any colon suffix before doing the interface
lookup, do the same for RTM_GETLINK requests.
Signed-off-by: Phil Sutter <phil@....cc>
---
net/core/rtnetlink.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index a51cab95ba64c..aaee4df0ff00c 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -3312,8 +3312,10 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr *nlh,
return PTR_ERR(tgt_net);
}
- if (tb[IFLA_IFNAME])
+ if (tb[IFLA_IFNAME]) {
nla_strlcpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ);
+ *strchrnul(ifname, ':') = '\0';
+ }
if (tb[IFLA_EXT_MASK])
ext_filter_mask = nla_get_u32(tb[IFLA_EXT_MASK]);
--
2.20.1
Powered by blists - more mailing lists