relaxed handling of ipV6 search response address

This commit is contained in:
Matej Sekoranja
2014-10-08 10:24:22 +02:00
parent 08659c3f39
commit 64b057c3ac
2 changed files with 9 additions and 4 deletions

View File

@@ -70,7 +70,9 @@ bool decodeAsIPv6Address(ByteBuffer* buffer, osiSockAddr* address) {
// first 80-bit are 0
if (buffer->getLong() != 0) return false;
if (buffer->getShort() != 0) return false;
if (buffer->getShort() != (int16)0xFFFF) return false;
int16 ffff = buffer->getShort();
// allow all zeros address
//if (ffff != (int16)0xFFFF) return false;
uint32_t ipv4Addr =
((uint32_t)(buffer->getByte()&0xFF))<<24 |
@@ -78,6 +80,9 @@ bool decodeAsIPv6Address(ByteBuffer* buffer, osiSockAddr* address) {
((uint32_t)(buffer->getByte()&0xFF))<<8 |
((uint32_t)(buffer->getByte()&0xFF));
if (ffff != (int16)0xFFFF && ipv4Addr != (uint32_t)0)
return false;
address->ia.sin_addr.s_addr = htonl(ipv4Addr);
return true;