From d1b014df9e70c7bc53b7ff48d576bc99cf843d13 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 23 Jul 2019 14:28:41 +0200 Subject: [PATCH] local-addresses: filter out any routing tables but the main one Fixes: #13132 --- src/shared/local-addresses.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/shared/local-addresses.c b/src/shared/local-addresses.c index 751144539bc..2f3d6756432 100644 --- a/src/shared/local-addresses.c +++ b/src/shared/local-addresses.c @@ -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; -- 2.47.3