]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
local-addresses: handle gracefully if routes lack an RTA_OIF attribute 7965/head
authorLennart Poettering <lennart@poettering.net>
Tue, 23 Jan 2018 14:48:28 +0000 (15:48 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 23 Jan 2018 14:48:28 +0000 (15:48 +0100)
Some routes (such as those using "nexthop") don't have an RTA_OIF
attribute. We need to handle that gracefully, by simply ignoring the
route.

Fixes: #7854
src/libsystemd/sd-netlink/local-addresses.c

index 23acec4061a04fc98804e587f53f11b47551a085..81e55b6d9f521ed7336488711d44a3b60e4e3e7d 100644 (file)
@@ -225,6 +225,8 @@ int local_gateways(sd_netlink *context, int ifindex, int af, struct local_addres
                         continue;
 
                 r = sd_netlink_message_read_u32(m, RTA_OIF, &ifi);
+                if (r == -ENODATA) /* Not all routes have an RTA_OIF attribute (for example nexthop ones) */
+                        continue;
                 if (r < 0)
                         return r;
                 if (ifindex > 0 && (int) ifi != ifindex)