- switch(record_type) {
- case rk_ns_t_srv:
-
- /* verify we actually have a SRV record here */
- if (!rr->u.srv) {
- continue;
- }
-
- /* Verify we got a port */
- if (rr->u.srv->port == 0) {
- continue;
- }
- count++;
- break;
- case rk_ns_t_a:
- case rk_ns_t_aaaa:
- /* verify we actually have a record here */
- if (!rr->u.data) {
- continue;
- }
- count++;
- break;
- default:
- count++;
- break;
+ /* we are only interested in A and AAAA records */
+ switch (rr->type) {
+ case QTYPE_A:
+ addr = inet_ntop(AF_INET,
+ (struct in_addr *)rr->data,
+ addrstr, sizeof(addrstr));
+ if (addr == NULL) {
+ continue;
+ }
+ break;
+ case QTYPE_AAAA:
+#ifdef HAVE_IPV6
+ addr = inet_ntop(AF_INET6,
+ (struct in6_addr *)rr->data,
+ addrstr, sizeof(addrstr));
+#else
+ addr = NULL;
+#endif
+ if (addr == NULL) {
+ continue;
+ }
+ default:
+ continue;
+ }
+
+ addrs[total] = talloc_asprintf(addrs, "%s@%u/%s",
+ addrstr, port,
+ rr->name->pLabelList->label);
+ if (addrs[total]) {
+ total++;
+ if (rr->type == QTYPE_A) {
+ (*a_num)++;
+ }