local-addresses: filter out any routing tables but the main one

Fixes: #13132
This commit is contained in:
Lennart Poettering 2019-07-23 14:28:41 +02:00
parent 733cbd00b0
commit d1b014df9e

View file

@ -175,7 +175,7 @@ int local_gateways(sd_netlink *context, int ifindex, int af, struct local_addres
for (m = reply; m; m = sd_netlink_message_next(m)) {
struct local_address *a;
uint16_t type;
unsigned char dst_len, src_len;
unsigned char dst_len, src_len, table;
uint32_t ifi;
int family;
@ -202,6 +202,12 @@ int local_gateways(sd_netlink *context, int ifindex, int af, struct local_addres
if (src_len != 0)
continue;
r = sd_rtnl_message_route_get_table(m, &table);
if (r < 0)
return r;
if (table != RT_TABLE_MAIN)
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;