diff -u ekeyd-1.1.1/debian/changelog ekeyd-1.1.1/debian/changelog
--- ekeyd-1.1.1/debian/changelog
+++ ekeyd-1.1.1/debian/changelog
@@ -1,3 +1,9 @@
+ekeyd (1.1.1-2) unstable; urgency=low
+
+  * Add IPv6 and DNS support.
+
+ -- Tollef Fog Heen <tfheen@debian.org>  Tue, 13 Apr 2010 11:57:25 +0200
+
 ekeyd (1.1.1-1) unstable; urgency=low
 
   * New upstream release
only in patch2:
unchanged:
--- ekeyd-1.1.1.orig/daemon/egd-linux.c
+++ ekeyd-1.1.1/daemon/egd-linux.c
@@ -3,6 +3,7 @@
  * Stand-alone EGD => Linux pool entropy transfer agent.
  *
  * Copyright 2009 Simtec Electronics.
+ * Copyrithg 2010 Collabora Ltd
  *
  * For licence terms refer to the COPYING file.
  */
@@ -10,6 +11,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <arpa/inet.h>
+#include <netdb.h>
 
 #include <stdint.h>
 #include <unistd.h>
@@ -30,14 +32,15 @@
 #include "daemonise.h"
 
 #define DEFAULT_HOST "127.0.0.1"
-#define DEFAULT_PORT 8888
+#define DEFAULT_PORT "8888"
 
 static const char *pidfilename = NULL;
 static int random_fd = 0;
 static int egd_fd = -1;
 static int shannons = 7;
 static unsigned int retry_time = 0;
-static struct sockaddr_in egd_addr;
+static char *host;
+static char *port;
 
 struct pollfd poll_fds[2] = {
     { .events = POLLOUT },
@@ -103,30 +106,54 @@
     int con_res = -1;
     int keepalive = 1;
     socklen_t keepalive_len = sizeof(keepalive);
+    struct addrinfo *addrs, *addrs_head;
+    struct addrinfo hints;
+    int r;
+
+    /* Look up port and address */
+    hints.ai_family = AF_UNSPEC;
+    hints.ai_socktype = SOCK_STREAM;
+    hints.ai_protocol = IPPROTO_TCP;
+    hints.ai_flags = AI_ADDRCONFIG | AI_V4MAPPED;
 
-    /* close fd if we already have one open */
-    if (egd_fd >= 0) {
-        close(egd_fd);
-    }
-
-    /* create socket */
-    egd_fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
-    if (egd_fd == -1) {
-        perror("socket");
+    if ((r = getaddrinfo(host, port, &hints, &addrs)) != 0) {
+        fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(r));
         return false;
     }
 
+    addrs_head = addrs;
+    do {
+        while (addrs) {
+            /* close fd if we already have one open */
+            if (egd_fd >= 0) {
+                close(egd_fd);
+            }
+            
+            /* create socket */
+            egd_fd = socket(addrs->ai_family, addrs->ai_socktype, addrs->ai_protocol);
+            if (egd_fd == -1) {
+                perror("socket");
+            return false;
+            }
+
+            con_res = connect(egd_fd, addrs->ai_addr, addrs->ai_addrlen);
+            if (con_res == 0) {
+                rtime = 0; /* get out of outer loop */
+                break;
+            }
+            addrs = addrs->ai_next;
+        }
+        if (rtime != 0) {
+            sleep(rtime);
+            fprintf(stderr, "Retrying connection.\n");
+        }
+        addrs = addrs_head;
+    } while (rtime != 0);
+    freeaddrinfo(addrs_head);
+
     /* Set the keepalive option active */
-   if (setsockopt(egd_fd, SOL_SOCKET, SO_KEEPALIVE, &keepalive, keepalive_len) < 0) {
-       perror("setsockopt");
-   }
-
-    con_res = connect(egd_fd, (const struct sockaddr*)&egd_addr, sizeof(egd_addr));
-
-    while ((rtime != 0) && (con_res != 0)) {
-        sleep(retry_time);
-        fprintf(stderr, "Retrying connection.\n");
-        con_res = connect(egd_fd, (const struct sockaddr*)&egd_addr, sizeof(egd_addr));
+    if (setsockopt(egd_fd, SOL_SOCKET, SO_KEEPALIVE, &keepalive, keepalive_len) < 0) {
+        perror("setsockopt");
     }
 
     if (con_res != 0) {
@@ -208,9 +235,8 @@
     int blocks = 4;
 
     /* setup default host address */
-    egd_addr.sin_family = AF_INET;
-    inet_pton(AF_INET, DEFAULT_HOST, &(egd_addr.sin_addr));
-    egd_addr.sin_port = htons(DEFAULT_PORT);
+    host = DEFAULT_HOST;
+    port = DEFAULT_PORT;
 
     /* command line option parsing */
     while ((opt = getopt(argc, argv, "vhH:p:D:b:S:r:")) != -1) {
@@ -226,14 +252,11 @@
             break;
 
         case 'H':
-            if (inet_pton(AF_INET, optarg, &(egd_addr.sin_addr)) != 1) {
-                fprintf(stderr, "Host \"%s\" could not be parsed\n", optarg);
-                return 1;
-            }
+            host = strdup(optarg);
             break;
 
         case 'p':
-            egd_addr.sin_port = htons(strtoul(optarg, NULL, 10));
+            port = strdup(optarg);
             break;
 
         case 'D':
