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
This commit is contained in:
Valentin Gosu 2024-10-15 15:25:15 +00:00
parent 21c254a2dd
commit b9e34ee730

View File

@ -48,6 +48,21 @@
#include <iptypes.h>
#include <iphlpapi.h>
#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");