diff options
author | Gert Doering | 2024-01-01 10:27:14 +0100 |
---|---|---|
committer | Gert Doering | 2024-01-01 18:18:44 +0100 |
commit | bfd5b12e49785cc658f6f2f86360797fd2201cdc (patch) | |
tree | f44bc41905cfb28bcf29b9ec845acc22446bbbef /src/openvpn/dco.h | |
parent | 77376fc5cf6235493bff78794c9c6589e3f710ad (diff) | |
download | openvpn-bfd5b12e49785cc658f6f2f86360797fd2201cdc.zip openvpn-bfd5b12e49785cc658f6f2f86360797fd2201cdc.tar.gz |
get_default_gateway() HWADDR overhaul
commit f13331005d5a7 (gerrit/454) most painfully works around the limitations
of the SIOCGIFCONF API, with struct member access on an unaligned buffer,
possibly overrunning sockaddr structures, etc. - and the result still did
not work on OpenSolaris and OpenBSD (no AF_LINK in the returned elements).
Reading through OpenBSD "ifconfig" source, I found getifaddrs(3), which
is exactly what we want here - it works on FreeBSD, NetBSD, OpenBSD and
MacOS, and all returned pointers are properly aligned, so the code gets
shorter, easier to read, and UBSAN is still happy.
OpenSolaris does have getifaddrs(3), but (surprise) it does not work, as
in "it does not return AF_LINK addresses". It does have SIOCGIFHWADDR,
instead, and "man if_tcp" claims "should behave in a manner compatible
with Linux" - so TARGET_SOLARIS gets a copy of the Linux code now (works).
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20240101092714.18992-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg27891.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 76d11614797617708c31dc3db22e3568fee3de6d)
Diffstat (limited to 'src/openvpn/dco.h')
0 files changed, 0 insertions, 0 deletions