Handle endianness correctly for ipv6