- /* XXX: This SUCKS. and i mean REALLY, REALLY sucks. Anyone who rewrites it pretty gets a cookie. */
- sprintf(query,"%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.%0x.ip6.int",
- ip->s6_addr[15] & 0x0f,
- (ip->s6_addr[15] & 0xf0) >> 4,
- ip->s6_addr[14] & 0x0f,
- (ip->s6_addr[14] & 0xf0) >> 4,
- ip->s6_addr[13] & 0x0f,
- (ip->s6_addr[13] & 0xf0) >> 4,
- ip->s6_addr[12] & 0x0f,
- (ip->s6_addr[12] & 0xf0) >> 4,
- ip->s6_addr[11] & 0x0f,
- (ip->s6_addr[11] & 0xf0) >> 4,
- ip->s6_addr[10] & 0x0f,
- (ip->s6_addr[10] & 0xf0) >> 4,
- ip->s6_addr[9] & 0x0f,
- (ip->s6_addr[9] & 0xf0) >> 4,
- ip->s6_addr[8] & 0x0f,
- (ip->s6_addr[8] & 0xf0) >> 4,
- ip->s6_addr[7] & 0x0f,
- (ip->s6_addr[7] & 0xf0) >> 4,
- ip->s6_addr[6] & 0x0f,
- (ip->s6_addr[6] & 0xf0) >> 4,
- ip->s6_addr[5] & 0x0f,
- (ip->s6_addr[5] & 0xf0) >> 4,
- ip->s6_addr[4] & 0x0f,
- (ip->s6_addr[4] & 0xf0) >> 4,
- ip->s6_addr[3] & 0x0f,
- (ip->s6_addr[3] & 0xf0) >> 4,
- ip->s6_addr[2] & 0x0f,
- (ip->s6_addr[2] & 0xf0) >> 4,
- ip->s6_addr[1] & 0x0f,
- (ip->s6_addr[1] & 0xf0) >> 4,
- ip->s6_addr[0] & 0x0f,
- (ip->s6_addr[0] & 0xf0) >> 4
- );
+ unsigned char* c = (unsigned char*)&ip->s6_addr;
+ if (c[0] == 0 && c[1] == 0 && c[2] == 0 && c[3] == 0 &&
+ c[4] == 0 && c[5] == 0 && c[6] == 0 && c[7] == 0 &&
+ c[8] == 0 && c[9] == 0 && c[10] == 0xFF && c[11] == 0xFF)
+ sprintf(query,"%d.%d.%d.%d.in-addr.arpa",c[15],c[14],c[13],c[12]);
+ else
+ DNS::MakeIP6Int(query, (in6_addr*)ip);