From b9e34ee7304541b19b8027ce40ec32b7c82b6aa7 Mon Sep 17 00:00:00 2001 From: Valentin Gosu Date: Tue, 15 Oct 2024 15:25:15 +0000 Subject: [PATCH] Bug 1924631 - Fix Win MinGW build r=necko-reviewers,kershaw Defines IN6_IS_ADDR_LINKLOCAL and IN6_IS_ADDR_LOOPBACK when the symbols aren't known. Differential Revision: https://phabricator.services.mozilla.com/D225630 --- netwerk/system/win32/nsNotifyAddrListener.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/netwerk/system/win32/nsNotifyAddrListener.cpp b/netwerk/system/win32/nsNotifyAddrListener.cpp index f098a65b1d59..2dc42c3d6a36 100644 --- a/netwerk/system/win32/nsNotifyAddrListener.cpp +++ b/netwerk/system/win32/nsNotifyAddrListener.cpp @@ -48,6 +48,21 @@ #include #include +#ifndef IN6_IS_ADDR_LOOPBACK +int IN6_IS_ADDR_LOOPBACK(const struct in6_addr* a) { + auto words = a->s6_words; + return (words[0] == 0) && (words[1] == 0) && (words[2] == 0) && + (words[3] == 0) && (words[4] == 0) && (words[5] == 0) && + (words[6] == 0) && (words[7] == 0x0100); +} +#endif + +#ifndef IN6_IS_ADDR_LINKLOCAL +# define IN6_IS_ADDR_LINKLOCAL(_addr) \ + ((((const uint8_t*)(_addr))[0] == 0xfe) && \ + ((((const uint8_t*)(_addr))[1] & 0xc0) == 0x80)) +#endif + using namespace mozilla; static LazyLogModule gNotifyAddrLog("nsNotifyAddr");