From: Yu Watanabe Date: Fri, 18 Jan 2019 22:59:17 +0000 (+0900) Subject: wait-online: do not fail if we receive invalid messages X-Git-Tag: v241-rc1~28 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=61a38e02650b8e7f097cadaa40aab0847605a383;p=thirdparty%2Fsystemd.git wait-online: do not fail if we receive invalid messages Fixes #11486. --- diff --git a/src/network/wait-online/manager.c b/src/network/wait-online/manager.c index e1ccc9ff676..67218b6db36 100644 --- a/src/network/wait-online/manager.c +++ b/src/network/wait-online/manager.c @@ -89,16 +89,25 @@ static int manager_process_link(sd_netlink *rtnl, sd_netlink_message *mm, void * assert(mm); r = sd_netlink_message_get_type(mm, &type); - if (r < 0) - goto fail; + if (r < 0) { + log_warning_errno(r, "rtnl: Could not get message type, ignoring: %m"); + return 0; + } r = sd_rtnl_message_link_get_ifindex(mm, &ifindex); - if (r < 0) - goto fail; + if (r < 0) { + log_warning_errno(r, "rtnl: Could not get ifindex from link, ignoring: %m"); + return 0; + } else if (ifindex <= 0) { + log_warning("rtnl: received link message with invalid ifindex %d, ignoring", ifindex); + return 0; + } r = sd_netlink_message_read_string(mm, IFLA_IFNAME, &ifname); - if (r < 0) - goto fail; + if (r < 0) { + log_warning_errno(r, "rtnl: Received link message without ifname, ignoring: %m"); + return 0; + } l = hashmap_get(m->links, INT_TO_PTR(ifindex)); @@ -110,16 +119,16 @@ static int manager_process_link(sd_netlink *rtnl, sd_netlink_message *mm, void * r = link_new(m, &l, ifindex, ifname); if (r < 0) - goto fail; + return log_error_errno(r, "Failed to create link object: %m"); r = link_update_monitor(l); if (r < 0) - goto fail; + return log_error_errno(r, "Failed to initialize link object: %m"); } r = link_update_rtnl(l, mm); if (r < 0) - goto fail; + return log_warning_errno(r, "Failed to process RTNL link message: %m");; break; @@ -133,10 +142,6 @@ static int manager_process_link(sd_netlink *rtnl, sd_netlink_message *mm, void * } return 0; - -fail: - log_warning_errno(r, "Failed to process RTNL link message: %m"); - return 0; } static int on_rtnl_event(sd_netlink *rtnl, sd_netlink_message *mm, void *userdata) {