From 50df02a705d78f8f4fa67cbac2b9d618c8a2a0dd Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 19 Nov 2021 05:36:44 +0900 Subject: [PATCH] network: do not clear map from alternative names to link when IFLA_PROP_LIST attribute is not contained No IFLA_PROP_LIST attribute contained does not means the interface has no alternative name. E.g. the message created by inet6_fill_ifinfo() in net/ipv6/addrconf.c does not contain IFLA_PROP_LIST. --- src/network/networkd-link.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index e0e7cd8cd7e..b3b41cd8f1c 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -2231,7 +2231,11 @@ static int link_update_alternative_names(Link *link, sd_netlink_message *message assert(message); r = sd_netlink_message_read_strv(message, IFLA_PROP_LIST, IFLA_ALT_IFNAME, &altnames); - if (r < 0 && r != -ENODATA) + if (r == -ENODATA) + /* The message does not have IFLA_PROP_LIST container attribute. It does not means the + * interface has no alternative name. */ + return 0; + if (r < 0) return log_link_debug_errno(link, r, "rtnl: failed to read alternative names: %m"); STRV_FOREACH(n, link->alternative_names) -- 2.47.3