local-addresses: handle gracefully if routes lack an RTA_OIF attribute

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
This commit is contained in:
Lennart Poettering 2018-01-23 15:48:28 +01:00
parent 875274a4d8
commit 568fc5c3f7

View 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)