netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next PATCH] net: rtnetlink: Support alias interfaces with RTM_GETLINK
@ 2019-02-07 10:24 Phil Sutter
  2019-02-07 12:27 ` Phil Sutter
  0 siblings, 1 reply; 6+ messages in thread
From: Phil Sutter @ 2019-02-07 10:24 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

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@nwl.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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-02-07 13:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-07 10:24 [net-next PATCH] net: rtnetlink: Support alias interfaces with RTM_GETLINK Phil Sutter
2019-02-07 12:27 ` Phil Sutter
2019-02-07 12:39   ` Michal Kubecek
2019-02-07 13:02     ` Phil Sutter
2019-02-07 13:21       ` Michal Kubecek
2019-02-07 13:52         ` Phil Sutter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).