chiark / gitweb /
resolver: Support IPv6 name resolution
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 2 Sep 2014 08:19:37 +0000 (09:19 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 2 Oct 2014 15:30:21 +0000 (16:30 +0100)
Tell adns (via ADNS_FEATURE_MANYAF) that we want mixed address
families in the results, and handle any IPv6 addresses we find.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
resolver.c
secnet.h

index 9f71716..6477777 100644 (file)
@@ -119,6 +119,15 @@ static void resolver_afterpoll(void *sst, struct pollfd *fds, int nfds)
                        ca->ia.sin.sin_port=  htons(q->port);
                        wslot++;
                        break;
                        ca->ia.sin.sin_port=  htons(q->port);
                        wslot++;
                        break;
+#ifdef CONFIG_IPV6
+                   case AF_INET6:
+                       assert(ra->len == sizeof(ca->ia.sin6));
+                       ca->ia.sin6.sin6_family=ra->addr.inet6.sin6_family;
+                       ca->ia.sin6.sin6_addr=  ra->addr.inet6.sin6_addr;
+                       ca->ia.sin6.sin6_port=  htons(q->port);
+                       wslot++;
+                       break;
+#endif /*CONFIG_IPV6*/
                    default:
                        break;
                    }
                    default:
                        break;
                    }
index 81ffbcb..6a3f270 100644 (file)
--- a/secnet.h
+++ b/secnet.h
@@ -3,6 +3,8 @@
 #ifndef secnet_h
 #define secnet_h
 
 #ifndef secnet_h
 #define secnet_h
 
+#define ADNS_FEATURE_MANYAF
+
 #include "config.h"
 #include <stdlib.h>
 #include <stdarg.h>
 #include "config.h"
 #include <stdlib.h>
 #include <stdarg.h>