]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: NHA_ID should be always set 18656/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 5 Feb 2021 02:51:21 +0000 (11:51 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 17 Feb 2021 18:56:26 +0000 (03:56 +0900)
src/network/networkd-nexthop.c

index 043625557a45ee73eb1421828b9fc1bdbcfee947..60e1db6c5451d462406dbb32de34666da2708f92 100644 (file)
@@ -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);