Subject: Re: DNS servers on windows

Re: DNS servers on windows

From: Patrick Valsecchi <pvalsecc_at_cisco.com>
Date: Fri, 03 May 2013 13:51:08 +0200

On 05/03/2013 01:35 PM, Steinar H. Gunderson wrote:
> 2013/5/3 Gisle Vanem <gvanem_at_broadpark.no>:
>> +static bool is_default_server(const struct ares_addr* addr)
>> +{
>> + return addr->family == AF_INET6 &&
>> + addr->addr.addr6._S6_un._S6_u8[0] == 0xFE &&
>> + addr->addr.addr6._S6_un._S6_u8[1] == 0xC0 &&
>> + addr->addr.addr6._S6_un._S6_u8[2] == 0x00 &&
>> + addr->addr.addr6._S6_un._S6_u8[3] == 0x00 &&
>> + addr->addr.addr6._S6_un._S6_u8[4] == 0x00 &&
>> + addr->addr.addr6._S6_un._S6_u8[5] == 0x00 &&
>> + addr->addr.addr6._S6_un._S6_u8[6] == 0xFF &&
>> + addr->addr.addr6._S6_un._S6_u8[7] == 0xFF;
>> +}
>>
>> Could this be simplified as (untested):
>>
>> return addr->family == AF_INET6 &&
>> IN6_IS_ADDR_LINKLOCAL(&addr->addrV6);
> You mean SITELOCAL, not LINKLOCAL, right?
>
> /* Steinar */
I guess he means IN6_IS_ADDR_SITELOCAL, yes. I didn't know of this macro.

But I have a few comments about that:
  - the macro checks only the first 10 bits of the IPv6 address and I
check the first 64 bits.
  - since this range has been deprecated, I guess the macro will go away...
  - the macro doesn't work with sockaddr_in6 as defined in ares_ipv6. So
I don't think it will work on every platforms...
Received on 2013-05-03