[openssl/openssl] bio_dgram vs IPv6
Michael Wojcik
Michael.Wojcik at microfocus.com
Tue Mar 29 18:55:39 UTC 2022
> From: openssl-users <openssl-users-bounces at openssl.org> On Behalf Of Matt
> Caswell
> Sent: Tuesday, 22 March, 2022 10:31
>
> There is already code in bss_dgram.c that is conditionally compiled on
> OPENSSL_USE_IPV6. Is it reasonable to assume that if AF_INET6 is defined
> then ip6.h exists?
I meant to look into this earlier but got distracted.
Windows has IPv6 support and defines AF_INET6, but does not have ip6.h (at least in the SDK version I have installed on this machine). If you do a search online you'll see many projects have copied the ip6.h from some other platform into their source trees for use by Windows.
I've confirmed it's present on:
* AIX 7.1
* HP-UX 11.31316
* Solaris 11.3
and of course on Linux generally. I don't have other platforms handy to test.
Windows will be the sticking point. However, the Microsoft Windows SDK includes a header shared/netiodef.h, which includes at least some of the structures defined by RFC 3542, albeit with different type and field names; and macros mapping the RFC 3542 names to those identifiers. At least the following are available in that header:
ip6_hdr
ip6_flow
ip6_plen
ip6_nxt
ip6_hops
ip6_hlim
ip6_src
ip6_dst
So something like this might work:
#if defined OPENSSL_SYS_WINDOWS
# include <shared/netiodef.h>
#else
# include <netinet/ip6.h>
#endif
(Note C does not require the argument of the operator "defined" to be parenthesized. Doing so just adds visual noise. ISO 9899-1999 6.10.1 #1.)
--
Michael Wojcik
More information about the openssl-users
mailing list