From: Gert Doering Date: Fri, 31 Jan 2025 08:46:51 +0000 (+0100) Subject: get_default_gateway(): implement platform support for Linux/SITNL X-Git-Tag: v2.7_alpha1~98 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f28c254da58c7a48592c2c63c0a98b38283405e8;p=thirdparty%2Fopenvpn.git get_default_gateway(): implement platform support for Linux/SITNL This adds Linux/SITNL platform functionality to the framework started by commit 9df51cf56 and commit 0fcfc8381f. v2: make comment reflect reality Change-Id: I1db72d7dca648a8ea4ec65d173290a819971305c Signed-off-by: Gert Doering Acked-by: Antonio Quartulli Message-Id: <20250131084651.24765-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30749.html Signed-off-by: Gert Doering --- diff --git a/src/openvpn/route.c b/src/openvpn/route.c index 3501e353d..dd37fb904 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -3332,8 +3332,8 @@ get_default_gateway(struct route_gateway_info *rgi, in_addr_t dest, openvpn_net_ CLEAR(*rgi); CLEAR(best_name); - /* get default gateway IP addr */ - if (net_route_v4_best_gw(ctx, NULL, &rgi->gateway.addr, best_name) == 0) + /* find best route to 'dest', get gateway IP addr + interface */ + if (net_route_v4_best_gw(ctx, &dest, &rgi->gateway.addr, best_name) == 0) { rgi->flags |= RGI_ADDR_DEFINED; if (!rgi->gateway.addr && best_name[0])