I found an old patch that makes analog only support ipv6 addresses:
http://yasu.asuka.net/soft/patch/analog-5.03-ipv6.patch.gz

Based on that, here's a patch that makes analog support ipv6 in addition
to ipv4, by first trying to parse the address as ipv4, and falling back
to ipv6 if it's not an ipv4 address.

Index: src/alias.c
===================================================================
--- src/alias.c (revision 13068)
+++ src/alias.c (working copy)
@@ -585,6 +585,7 @@
 #endif
   volatile logical done = FALSE;
 #ifndef MAC
+  struct in6_addr addr6;
   IN_ADDR_T addr;
 #ifdef VMS
   char *addrp;
@@ -605,9 +606,17 @@
   done = IpAddr2Name(name);
   /* Doesn't currently include code to use SIGALRM */
 #else
+  addrp=NULL;
   addr = inet_addr(name);
   if (addr != INET_ADDR_ERR) {
     addrp = (char *) &addr;
+  }
+  else {
+    if (inet_pton(AF_INET6, name, &addr6) > 0) {
+      addrp = (char *) &addr6;
+    }
+  }
+  if (addrp) {
 #ifndef NOALARM
     if (SETJMP(jumpbuf))
       signal(SIGALRM, SIG_DFL);
@@ -616,7 +625,10 @@
       signal(SIGALRM, sighandler);
       alarm(dnstimeout);
 #endif
-      tempp = gethostbyaddr(addrp, sizeof(IN_ADDR_T), AF_INET);
+      if (addr != INET_ADDR_ERR)
+        tempp = gethostbyaddr(addrp, sizeof(IN_ADDR_T), AF_INET);
+      else
+        tempp = gethostbyaddr(addrp, sizeof(struct in6_addr), AF_INET6);
 #ifndef NOALARM
       alarm(0);
       signal(SIGALRM, SIG_DFL);

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature

Reply via email to