Message ID | 20210826061725.22169-1-a@unstable.cc |
---|---|
State | Accepted |
Headers | show |
Series | [Openvpn-devel] route.c: pass the right parameter to IN6_IS_ADDR_UNSPECIFIED | expand |
Am 26.08.21 um 08:17 schrieb Antonio Quartulli: > IN6_IS_ADDR_UNSPECIFIED on most systems is defined as a macro that > expects a struct in6_addr* argument. > > In one instance we are passing the right address but using a wrong type. > Fix this invocation by properly passing the right pointer. > > This issue might become more critical on systems implementing > IN6_IS_ADDR_UNSPECIFIED as a function rather than a macro. This happens if you try to compile openvpn with the Android NDK but without TARGET_ANDROID but with TARGET_LINUX. #define IN6_IS_ADDR_UNSPECIFIED(a) \ ((((a)->s6_addr32[0]) == 0) && \ (((a)->s6_addr32[1]) == 0) && \ (((a)->s6_addr32[2]) == 0) && \ (((a)->s6_addr32[3]) == 0)) So you get /Users/arne/oss/android-sdk-macosx/ndk/23.0.7599858/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/netinet/in6.h:38:9: note: expanded from macro 'IN6_IS_ADDR_UNSPECIFIED' (((a)->s6_addr32[1]) == 0) && \ ~~~^ ~~~~~~~~~ /Users/arne/software/icsopenvpn/main/src/main/cpp/openvpn/src/openvpn/route.c:3375:14: error: member reference base type '__u8' (aka 'unsigned char') is not a structure or union if (!IN6_IS_ADDR_UNSPECIFIED(rgi6->gateway.addr_ipv6.s6_addr)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Acked-By: Arne Schwabe <arne@rfc2549.org>
I have not tested this beyond "openvpn --show-gateway", and that one still works :-) - also, we've discussed this on IRC before. Your patch has been applied to the master and release/2.5 branch (bugfix). 2.4 does not contain the offending code. commit aa0e44e235f7bee0e12707b6899d00bad85195fc (master) commit 477781335cbca1aec69a372cbc18bf086155eea1 (release/2.5) Author: Antonio Quartulli Date: Thu Aug 26 08:17:25 2021 +0200 route.c: pass the right parameter to IN6_IS_ADDR_UNSPECIFIED Signed-off-by: Antonio Quartulli <a@unstable.cc> Message-Id: <20210826061725.22169-1-a@unstable.cc> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22767.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 2905e432..fd1125ef 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -3360,7 +3360,7 @@ get_default_gateway_ipv6(struct route_ipv6_gateway_info *rgi6, if (net_route_v6_best_gw(ctx, dest, &rgi6->gateway.addr_ipv6, rgi6->iface) == 0) { - if (!IN6_IS_ADDR_UNSPECIFIED(rgi6->gateway.addr_ipv6.s6_addr)) + if (!IN6_IS_ADDR_UNSPECIFIED(&rgi6->gateway.addr_ipv6)) { rgi6->flags |= RGI_ADDR_DEFINED; }
IN6_IS_ADDR_UNSPECIFIED on most systems is defined as a macro that expects a struct in6_addr* argument. In one instance we are passing the right address but using a wrong type. Fix this invocation by properly passing the right pointer. This issue might become more critical on systems implementing IN6_IS_ADDR_UNSPECIFIED as a function rather than a macro. Signed-off-by: Antonio Quartulli <a@unstable.cc> --- src/openvpn/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)