Message ID | 20250214153434.18539-1-gert@greenie.muc.de |
---|---|
State | Accepted |
Headers | show |
Series | [Openvpn-devel,v3] get_default_gateway(): Prevent passing IPV4_INVALID_ADDR as a destination | expand |
There has been quite a bit of discussion about this one-liner on #openvpn-devel - this is not a particularily pretty piece of code, nor easy to understand. It's intended as a "do not break existing setups" bandaid, while we spend more thoughts on making this work better, and also clarify for ourselves and the documentation what "default gateway" and "route ... net_gateway" really means :-) - and possibly drop "non def1" redirection, which will simplify more of this. Thanks for looking into this :-) Your patch has been applied to the master branch. commit 75ba07d496da269b13fc368311f8a063b65d58e7 Author: Marco Baffo Date: Fri Feb 14 16:34:34 2025 +0100 get_default_gateway(): Prevent passing IPV4_INVALID_ADDR as a destination Signed-off-by: Marco Baffo <marco@mandelbit.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20250214153434.18539-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30895.html Signed-off-by: Gert Doering <gert@greenie.muc.de> -- kind regards, Gert Doering
diff --git a/src/openvpn/route.c b/src/openvpn/route.c index d895e1c..bc41492 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -655,7 +655,7 @@ rl->spec.flags |= RTSA_DEFAULT_METRIC; } - get_default_gateway(&rl->rgi, remote_host, ctx); + get_default_gateway(&rl->rgi, remote_host != IPV4_INVALID_ADDR ? remote_host : INADDR_ANY, ctx); if (rl->rgi.flags & RGI_ADDR_DEFINED) { setenv_route_addr(es, "net_gateway", rl->rgi.gateway.addr, -1);