[PATCH] relayd: don't break localhost

Dmitry Ivanov dimss79 at inbox.lv
Fri Jul 9 07:35:30 PDT 2021


Relayd is adding default route to its routing tables when it's found in
DHCP response. Adding default route to routing table associated with
loopback interface makes no sense other than breaking localhost so that
DNS requests to local dnsmasq and even "ping 127.0.0.1" go to default
gateway.

This patch prevents insertion of default route into "localhost" policy
routing table created by relayd.

Signed-off-by: Dmitry Ivanov <dimss79 at inbox.lv>
---
 route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/route.c b/route.c
index c552d1f..f7cf815 100644
--- a/route.c
+++ b/route.c
@@ -243,7 +243,7 @@ rtnl_route_set(struct relayd_host *host, struct 
relayd_route *route, bool add)
 
 		rtnl_route_request(rif, host, route, add);
 	}
-	if (local_route_table)
+	if (local_route_table && route && route->mask)
 		rtnl_route_request(NULL, host, route, add);
 }
 
-- 
2.30.2







More information about the openwrt-devel mailing list