All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] rtnetlink: enable alt_ifname for setlink/newlink
@ 2022-03-31 12:37 Florent Fourcot
  2022-04-01  3:54 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Florent Fourcot @ 2022-03-31 12:37 UTC (permalink / raw)
  To: netdev; +Cc: Florent Fourcot, Brian Baboch

buffer is always valid when called by setlink/newlink,
but contains only empty string when IFLA_IFNAME is not given. So
IFLA_ALT_IFNAME is always ignored

Fixes: 76c9ac0ee878 ("net: rtnetlink: add possibility to use alternative names as message handle")
Signed-off-by: Florent Fourcot <florent.fourcot@wifirst.fr>
Signed-off-by: Brian Baboch <brian.baboch@wifirst.fr>
---
 net/core/rtnetlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 3313419bbcba..613065a53b34 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2979,7 +2979,7 @@ static struct net_device *rtnl_dev_get(struct net *net,
 {
 	char buffer[ALTIFNAMSIZ];
 
-	if (!ifname) {
+	if (!ifname || !ifname[0]) {
 		ifname = buffer;
 		if (ifname_attr)
 			nla_strscpy(ifname, ifname_attr, IFNAMSIZ);
-- 
2.30.2


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

end of thread, other threads:[~2022-04-01  3:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-31 12:37 [PATCH net-next] rtnetlink: enable alt_ifname for setlink/newlink Florent Fourcot
2022-04-01  3:54 ` Jakub Kicinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.