While investigating why IPV6_HOPLIMIT isn't always defined on Mac OS, I realized that we really need some tests for the three IPV6 control messages that Windows can return from WSARecvMsg (IPV6_HOPLIMIT, IPV6_PKTINFO, and IPV6_RTHDR), and in order to write those tests, the corresponding structures need to be defined.
Alex Henrie (2): include: Add IN6_PKTINFO include: Add IPV6_ROUTING_HEADER
include/netiodef.h | 32 ++++++++++++++++++++++++++++++++ include/ws2ipdef.h | 5 +++++ 2 files changed, 37 insertions(+) create mode 100644 include/netiodef.h
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- include/ws2ipdef.h | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/include/ws2ipdef.h b/include/ws2ipdef.h index fc465804962..db0893827a9 100644 --- a/include/ws2ipdef.h +++ b/include/ws2ipdef.h @@ -177,6 +177,11 @@ typedef struct WS(in_pktinfo) { UINT ipi_ifindex; } IN_PKTINFO, *PIN_PKTINFO;
+typedef struct WS(in6_pktinfo) { + IN6_ADDR ipi6_addr; + ULONG ipi6_ifindex; +} WS(IN6_PKTINFO), *WS(PIN6_PKTINFO); + #ifndef USE_WS_PREFIX #define IPV6_OPTIONS 1 #define IPV6_HDRINCL 2
On 5/3/21 10:28 AM, Alex Henrie wrote:
Signed-off-by: Alex Henrie alexhenrie24@gmail.com
include/ws2ipdef.h | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/include/ws2ipdef.h b/include/ws2ipdef.h index fc465804962..db0893827a9 100644 --- a/include/ws2ipdef.h +++ b/include/ws2ipdef.h @@ -177,6 +177,11 @@ typedef struct WS(in_pktinfo) { UINT ipi_ifindex; } IN_PKTINFO, *PIN_PKTINFO;
+typedef struct WS(in6_pktinfo) {
- IN6_ADDR ipi6_addr;
- ULONG ipi6_ifindex;
+} WS(IN6_PKTINFO), *WS(PIN6_PKTINFO);
- #ifndef USE_WS_PREFIX #define IPV6_OPTIONS 1 #define IPV6_HDRINCL 2
I don't think you need to guard the all-caps typedefs with WS().
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- include/netiodef.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 include/netiodef.h
diff --git a/include/netiodef.h b/include/netiodef.h new file mode 100644 index 00000000000..2a50e859842 --- /dev/null +++ b/include/netiodef.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 Alex Henrie + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __NETIODEF__ +#define __NETIODEF__ + +#include <ws2def.h> + +typedef struct _IPV6_ROUTING_HEADER { + UCHAR NextHeader; + UCHAR Length; + UCHAR RoutingType; + UCHAR SegmentsLeft; + UCHAR Reserved[4]; +} IPV6_ROUTING_HEADER, *PIPV6_ROUTING_HEADER; + +#ifndef USE_WS_PREFIX +#define ip6_rthdr _IPV6_ROUTING_HEADER +#else +#define WS_ip6_rthdr _IPV6_ROUTING_HEADER +#endif + +#endif /* __NETIODEF__ */
It looks like setsockopt with IPV6_RTHDR returns an invalid parameter error, so we might not actually need IPV6_ROUTING_HEADER in Wine yet.
I have written some tests for IPV6_PKTINFO that definitely need IN6_PKTINFO though.
-Alex