Questions regarding ipv6 and bind9
Ford, Michael
michael.ford at lmco.com
Wed Oct 10 18:36:04 UTC 2007
Hello all,
My friend and I are messing around with ipv6 on BIND9. We have created
the following zone file:
$TTL 1D
$ORIGIN example.com.
@ IN SOA @ root (
1 ; Serial
8H ; Refresh
15M ; Retry
1W ; Expire
1D) ; Minimum TTL
IN NS @
IN AAAA 2001:0db8:85a3:08d3:1319:a82e:0370:7344
And we have the following code snippet to test our dns server:
int main()
{
////////////////////// IPv6 ///////////////////////
struct addrinfo *aInfo;
char straddr[INET6_ADDRSTRLEN];
struct sockaddr_in6 target;
if(getaddrinfo("example.com", NULL, NULL, &aInfo) != 0)
{
printf("ERROR");
perror("getaddrinfo");
return 0;
}
printf("aInfo->ai_addrlen is: %d\n", aInfo->ai_addrlen);
memset((char *)&target, 0, sizeof(target));
memcpy((char*)&target.sin6_addr, aInfo->ai_addr,
aInfo->ai_addrlen);
printf("addrInfo = %s\n", inet_ntop(AF_INET6,
&target.sin6_addr, straddr, sizeof(straddr)));
return 0;
}
However, when we run out code, we get the following output:
$ ./a.out
aInfo->ai_addrlen is: 28
addrInfo = a00::2001:db8:85a3:8d3
I have no problem with cutting off the leading zeros, but what is the
a00:: doing in front of the ip address, and why is the full ip address
not being printed?
-Mike-
More information about the bind-users
mailing list