From a1299e1dfe66dffd82f6798fed5cbdd7a6853ad3 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 20 Mar 2022 05:18:14 +0300 Subject: [PATCH] common: third iteration of ipv6 netadr_t, now binary compatible with v4-to-v6 mapped addresses --- common/netadr.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/common/netadr.h b/common/netadr.h index bd8c7879..6404e640 100644 --- a/common/netadr.h +++ b/common/netadr.h @@ -21,7 +21,7 @@ typedef enum { - NA_UNUSED, + NA_UNUSED = 0, NA_LOOPBACK, NA_BROADCAST, NA_IP, @@ -50,23 +50,20 @@ typedef struct netadr_s struct { uint32_t type; - uint8_t ip[4]; - uint8_t ipx[10]; }; struct { #if XASH_LITTLE_ENDIAN uint16_t type6; - uint8_t ip6_0[2]; + uint8_t ip6_10[2]; // or 10-th two IPv6 octets #elif XASH_BIG_ENDIAN - uint8_t ip6_0[2]; + uint8_t ip6_10[2]; // or 10-th two IPv6 octets uint16_t type6; -#else -#error #endif - uint8_t ip6_1[14]; }; }; + uint8_t ip[4]; // or last 4 IPv6 octets + uint8_t ipx[10]; // or first 10 IPv6 octets uint16_t port; } netadr_t; #pragma pack( pop )