From 69aeaabcfb62d1821275cd0c076ef557c6814c51 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 13 Mar 2018 13:05:28 +0100 Subject: [PATCH] interface-ip: fix route selection for host dependencies In order to find the best match, allow overriding the last found entry if route->mask for the new entry is bigger than the one from the previous entry. Patch submitted by 'Mikael' in FS#1358 Signed-off-by: Felix Fietkau --- interface-ip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface-ip.c b/interface-ip.c index 6ccc03e..4a3e2c0 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -204,7 +204,7 @@ __find_ip_route_target(struct interface_ip_settings *ip, union if_addr *a, if (route->flags & DEVROUTE_TABLE) continue; - if (!*res || route->mask < (*res)->mask) + if (!*res || route->mask > (*res)->mask) *res = route; } } -- 2.11.0