more cross platform check
This commit is contained in:
+8
-8
@@ -330,16 +330,16 @@ void handleClient(int pSock, char *pPassword, char *pHWADDR)
|
||||
port = ntohs(s->sin6_port);
|
||||
inet_ntop(AF_INET6, &s->sin6_addr, ipstr, sizeof ipstr);
|
||||
|
||||
#ifndef __APPLE__
|
||||
#define __u6_addr __in6_u
|
||||
#endif
|
||||
|
||||
if (s->sin6_addr.__u6_addr.__u6_addr32[0] == 0 &&
|
||||
s->sin6_addr.__u6_addr.__u6_addr32[1] == 0 &&
|
||||
s->sin6_addr.__u6_addr.__u6_addr32[2] == 0xffff0000)
|
||||
union {
|
||||
struct sockaddr_in6 s;
|
||||
unsigned char bin[sizeof(struct sockaddr_in6)];
|
||||
} addr;
|
||||
memcpy(&addr.s, &s->sin6_addr, sizeof(struct sockaddr_in6));
|
||||
|
||||
if(memcmp(&addr.bin[0], "\x00\x00\x00\x00" "\x00\x00\x00\x00" "\xff\xff\x00\x00", 12) == 0)
|
||||
{
|
||||
// its ipv4...
|
||||
memcpy(ipbin, &s->sin6_addr.__u6_addr.__u6_addr32[3], 4);
|
||||
memcpy(ipbin, &addr.bin[12], 4);
|
||||
ipbinlen = 4;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user