From ccbd74f602262e2e7bde4486815fae65d64393ad Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 5 Feb 2021 11:51:21 +0900 Subject: [PATCH] network: NHA_ID should be always set --- src/network/networkd-nexthop.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/network/networkd-nexthop.c b/src/network/networkd-nexthop.c index 043625557a4..60e1db6c545 100644 --- a/src/network/networkd-nexthop.c +++ b/src/network/networkd-nexthop.c @@ -415,9 +415,15 @@ int manager_rtnl_process_nexthop(sd_netlink *rtnl, sd_netlink_message *message, } r = sd_netlink_message_read_u32(message, NHA_ID, &tmp->id); - if (r < 0 && r != -ENODATA) { + if (r == -ENODATA) { + log_link_warning_errno(link, r, "rtnl: received nexthop message without NHA_ID attribute, ignoring: %m"); + return 0; + } else if (r < 0) { log_link_warning_errno(link, r, "rtnl: could not get NHA_ID attribute, ignoring: %m"); return 0; + } else if (tmp->id == 0) { + log_link_warning(link, "rtnl: received nexthop message with invalid nexthop ID, ignoring: %m"); + return 0; } (void) nexthop_get(link, tmp, &nexthop); -- 2.47.3