pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/net/wget ipv6-mapped ipv4 addresses aren't enabled by ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/3de06336aaa7
branches:  trunk
changeset: 488221:3de06336aaa7
user:      bouyer <bouyer%pkgsrc.org@localhost>
date:      Tue Jan 25 20:07:25 2005 +0000

description:
ipv6-mapped ipv4 addresses aren't enabled by default on NetBSD, and probably
others OS as well. Patch wget so that it won't try to use ipv6-mapped ipv4
addresses, but uses INET4 socket sockets instead. Bump pkgrev.

Fix issues with v6-enabled wget reported on tech-pkg.

diffstat:

 net/wget/Makefile         |    4 +-
 net/wget/distinfo         |    6 +-
 net/wget/patches/patch-aa |  109 +++++++++++++++++++++++++
 net/wget/patches/patch-ab |  103 ++++++++++++++++++++++++
 net/wget/patches/patch-ac |  195 ++++++++++++++++++++++++++++++++++++++++++++++
 net/wget/patches/patch-ad |   30 +++++++
 6 files changed, 444 insertions(+), 3 deletions(-)

diffs (truncated from 481 to 300 lines):

diff -r 7bcd0cf0283d -r 3de06336aaa7 net/wget/Makefile
--- a/net/wget/Makefile Tue Jan 25 19:35:17 2005 +0000
+++ b/net/wget/Makefile Tue Jan 25 20:07:25 2005 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.77 2005/01/13 13:33:19 bouyer Exp $
+# $NetBSD: Makefile,v 1.78 2005/01/25 20:07:25 bouyer Exp $
 
 DISTNAME=      wget-1.9.1
-PKGREVISION=   3
+PKGREVISION=   4
 CATEGORIES=    net
 MASTER_SITES=  ${MASTER_SITE_GNU:=wget/}
 
diff -r 7bcd0cf0283d -r 3de06336aaa7 net/wget/distinfo
--- a/net/wget/distinfo Tue Jan 25 19:35:17 2005 +0000
+++ b/net/wget/distinfo Tue Jan 25 20:07:25 2005 +0000
@@ -1,6 +1,10 @@
-$NetBSD: distinfo,v 1.21 2004/05/16 20:27:04 danw Exp $
+$NetBSD: distinfo,v 1.22 2005/01/25 20:07:25 bouyer Exp $
 
 SHA1 (wget-1.9.1.tar.gz) = 0597a4f47b056e3e60cf7d08c9409d67358e7099
 Size (wget-1.9.1.tar.gz) = 1322378 bytes
+SHA1 (patch-aa) = 6ddfbceb3d66c8bce99695cf5be50b7b91aee7b2
+SHA1 (patch-ab) = b00db7f71a3add563121066a3bfd378019d206bf
+SHA1 (patch-ac) = 446cdbf75dd863fd07410a93e4230796fd092a47
+SHA1 (patch-ad) = 7605ad58dfc5e6982a06437d953ec8ceb55c86e7
 SHA1 (patch-ag) = d13900b60f52cac6c71f701026e6de8b32f00354
 SHA1 (patch-ah) = e31060497c77f87f0ed4cab44e63597654ca0525
diff -r 7bcd0cf0283d -r 3de06336aaa7 net/wget/patches/patch-aa
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/wget/patches/patch-aa Tue Jan 25 20:07:25 2005 +0000
@@ -0,0 +1,109 @@
+$NetBSD: patch-aa,v 1.7 2005/01/25 20:07:25 bouyer Exp $
+
+--- src/connect.c.orig Sat Nov  1 15:08:22 2003
++++ src/connect.c      Sun Jan 23 22:11:24 2005
+@@ -155,11 +155,11 @@
+   int sock, save_errno;
+ 
+   /* Set port and protocol */
+-  wget_sockaddr_set_address (&sa, ip_default_family, port, addr);
++  wget_sockaddr_set_address (&sa, port, addr, addr->family);
+ 
+   if (!silent)
+     {
+-      char *pretty_addr = pretty_print_address (addr);
++      char *pretty_addr = pretty_print_address (addr->bytes);
+       if (connection_host_name
+         && 0 != strcmp (connection_host_name, pretty_addr))
+       logprintf (LOG_VERBOSE, _("Connecting to %s[%s]:%hu... "),
+@@ -170,7 +170,7 @@
+     }
+ 
+   /* Make an internet socket, stream type.  */
+-  sock = socket (ip_default_family, SOCK_STREAM, 0);
++  sock = socket (addr->family, SOCK_STREAM, 0);
+   if (sock < 0)
+     goto out;
+ 
+@@ -196,8 +196,8 @@
+     {
+       /* Bind the client side to the requested address. */
+       wget_sockaddr bsa;
+-      wget_sockaddr_set_address (&bsa, ip_default_family, 0, &bind_address);
+-      if (bind (sock, &bsa.sa, sockaddr_len ()))
++      wget_sockaddr_set_address (&bsa, 0, &bind_address, bind_address.family);
++      if (bind (sock, &bsa.sa, sockaddr_len (bind_address.family)))
+       {
+         CLOSE (sock);
+         sock = -1;
+@@ -206,7 +206,7 @@
+     }
+ 
+   /* Connect the socket to the remote host.  */
+-  if (connect_with_timeout (sock, &sa.sa, sockaddr_len (),
++  if (connect_with_timeout (sock, &sa.sa, sockaddr_len (addr->family),
+                           opt.connect_timeout) < 0)
+     {
+       CLOSE (sock);
+@@ -248,8 +248,11 @@
+ 
+       sock = connect_to_one (&addr, port, silent);
+       if (sock >= 0)
+-      /* Success. */
+-      return sock;
++        {
++        /* Success. */
++          ip_default_family = addr.family;
++        return sock;
++        }
+ 
+       address_list_set_faulty (al, i);
+ 
+@@ -316,9 +319,10 @@
+ #endif
+ 
+   resolve_bind_address ();
+-  wget_sockaddr_set_address (&srv, ip_default_family, htons (*port),
+-                           bind_address_resolved ? &bind_address : NULL);
+-  if (bind (msock, &srv.sa, sockaddr_len ()) < 0)
++  wget_sockaddr_set_address (&srv, htons (*port),
++                           bind_address_resolved ? &bind_address : NULL,
++                             family);
++  if (bind (msock, &srv.sa, sockaddr_len (family)) < 0)
+     {
+       CLOSE (msock);
+       msock = -1;
+@@ -327,7 +331,7 @@
+   DEBUGP (("Master socket fd %d bound.\n", msock));
+   if (!*port)
+     {
+-      socklen_t sa_len = sockaddr_len ();
++      socklen_t sa_len = sockaddr_len (family);
+       if (getsockname (msock, &srv.sa, &sa_len) < 0)
+       {
+         CLOSE (msock);
+@@ -389,7 +393,7 @@
+ uerr_t
+ acceptport (int *sock)
+ {
+-  socklen_t addrlen = sockaddr_len ();
++  socklen_t addrlen = sockaddr_len (ip_default_family);
+ 
+ #ifdef HAVE_SELECT
+   if (opt.connect_timeout)
+@@ -429,11 +433,13 @@
+     {
+ #ifdef ENABLE_IPV6
+     case AF_INET6:
+-      memcpy (ip, &mysrv.sin6.sin6_addr, 16);
++      memcpy (ip->bytes, &mysrv.sin6.sin6_addr, 16);
++      ip->family = AF_INET6;
+       return 1;
+ #endif
+     case AF_INET:
+-      map_ipv4_to_ip ((ip4_address *)&mysrv.sin.sin_addr, ip);
++      memcpy (ip->bytes, &mysrv.sin.sin_addr, 4);
++      ip->family = AF_INET;
+       return 1;
+     default:
+       abort ();
diff -r 7bcd0cf0283d -r 3de06336aaa7 net/wget/patches/patch-ab
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/wget/patches/patch-ab Tue Jan 25 20:07:25 2005 +0000
@@ -0,0 +1,103 @@
+$NetBSD: patch-ab,v 1.7 2005/01/25 20:07:25 bouyer Exp $
+
+--- src/ftp-basic.c.orig       Sat Nov  8 20:17:55 2003
++++ src/ftp-basic.c    Sun Jan 23 22:20:35 2005
+@@ -267,7 +267,7 @@
+ 
+   /* Setting port to 0 lets the system choose a free port.  */
+   port = 0;
+-  err = bindport (&port, ip_default_family);
++  err = bindport (&port, AF_INET6);
+   if (err != BINDOK)  /* Bind the port.  */
+     return err;
+ 
+@@ -275,7 +275,8 @@
+   if (!conaddr (RBUF_FD (rbuf), &in_addr))
+     /* Huh?  This is not BINDERR! */
+     return BINDERR;
+-  inet_ntop (AF_INET6, &in_addr, ipv6, sizeof (ipv6));
++  inet_ntop (AF_INET6, in_addr.bytes, ipv6, sizeof (ipv6));
++  in_addr.family = AF_INET6;
+ 
+   /* Construct the argument of EPRT (of the form |2|IPv6.ascii|PORT.ascii|). */
+   bytes = alloca (3 + strlen (ipv6) + 1 + numdigit (port) + 1 + 1);
+@@ -319,8 +320,6 @@
+   char bytes[6 * 4 +1];
+ 
+   ip_address in_addr;
+-  ip4_address in_addr_4;
+-  unsigned char *in_addr4_ptr = (unsigned char *)&in_addr_4;
+ 
+   int nwritten;
+   unsigned short port;
+@@ -347,16 +346,14 @@
+   if (!conaddr (RBUF_FD (rbuf), &in_addr))
+     /* Huh?  This is not BINDERR! */
+     return BINDERR;
+-  if (!map_ip_to_ipv4 (&in_addr, &in_addr_4))
+-    return BINDERR;
+ 
+   /* Construct the argument of PORT (of the form a,b,c,d,e,f).  Port
+      is unsigned short so (unsigned) (port & 0xff000) >> 8 is the same
+      like port >> 8
+    */
+   sprintf (bytes, "%d,%d,%d,%d,%d,%d",
+-         in_addr4_ptr[0], in_addr4_ptr[1], in_addr4_ptr[2], in_addr4_ptr[3],
+-         port >> 8, port & 0xff);
++         in_addr.bytes[0], in_addr.bytes[1], in_addr.bytes[2],
++           in_addr.bytes[3], port >> 8, port & 0xff);
+   /* Send PORT request.  */
+   request = ftp_request ("PORT", bytes);
+   nwritten = iwrite (RBUF_FD (rbuf), request, strlen (request));
+@@ -426,10 +423,12 @@
+     switch(remote.sa.sa_family)
+       {
+         case AF_INET6:
+-          memcpy (addr, &remote.sin6.sin6_addr, 16);
++          memcpy (&addr->bytes[0], &remote.sin6.sin6_addr, 16);
++          addr->family =   AF_INET6;
+         break;
+       case AF_INET:  
+-          map_ipv4_to_ip ((ip4_address *)&ipv4_sock->sin_addr, addr);
++          memcpy (&addr->bytes[0], &remote.sin.sin_addr, 4);
++          addr->family =   AF_INET;
+         break;
+       default:
+         abort();
+@@ -454,15 +453,12 @@
+   unsigned char addr4[4];
+ 
+ #ifdef ENABLE_IPV6
+-  if (ip_default_family == AF_INET6) 
+-    {
+       err = ftp_epsv (rbuf, addr, port, "2"); /* try IPv6 with EPSV */
+       if (FTPOK == err) 
+         return FTPOK;
+       err = ftp_epsv (rbuf, addr, port, "1"); /* try IPv4 with EPSV */
+       if (FTPOK == err) 
+         return FTPOK;
+-    }
+ #endif  
+   /* Form the request.  */
+   request = ftp_request ("PASV", NULL);
+@@ -505,9 +501,8 @@
+           return FTPINVPASV;
+         }
+     }
+-
+-  /* Eventually make an IPv4 in IPv6 adress if needed */
+-  map_ipv4_to_ip ((ip4_address *)addr4, addr);
++  memcpy(addr->bytes, addr4, 4);
++  addr->family = AF_INET;
+ 
+   *port=0;
+   for (; ISDIGIT (*s); s++)
+@@ -526,7 +521,7 @@
+       port2 = (*s - '0') + 10 * port2;
+     *port = (*port) * 256 + port2;
+   }
+-  xfree (respline);
++  xfree (respline); 
+   return FTPOK;
+ }
+ 
diff -r 7bcd0cf0283d -r 3de06336aaa7 net/wget/patches/patch-ac
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/wget/patches/patch-ac Tue Jan 25 20:07:25 2005 +0000
@@ -0,0 +1,195 @@
+$NetBSD: patch-ac,v 1.7 2005/01/25 20:07:25 bouyer Exp $
+
+--- src/host.c.orig    Sun Oct 26 02:38:25 2003
++++ src/host.c Sun Jan 23 21:23:28 2005
+@@ -189,13 +189,15 @@
+     if (ai->ai_family == AF_INET6) 
+       {
+       struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)ai->ai_addr;
+-      memcpy (al->addresses + i, &sin6->sin6_addr, 16);
++      memcpy (al->addresses[i].bytes, &sin6->sin6_addr, 16);
++      al->addresses[i].family = AF_INET6;
+       ++i;
+       } 
+     else if (ai->ai_family == AF_INET)
+       {
+       struct sockaddr_in *sin = (struct sockaddr_in *)ai->ai_addr;
+-        map_ipv4_to_ip ((ip4_address *)&sin->sin_addr, al->addresses + i);
++      memcpy (al->addresses[i].bytes, &sin->sin_addr, 4);
++      al->addresses[i].family = AF_INET;
+       ++i;
+       }
+   assert (i == cnt);
+@@ -219,8 +221,11 @@
+   al->addresses = xmalloc (count * sizeof (ip_address));
+   al->refcount  = 1;
+ 
+-  for (i = 0; i < count; i++)
+-    map_ipv4_to_ip ((ip4_address *)h_addr_list[i], al->addresses + i);
++  for (i = 0; i < count; i++) {
++    memcpy (al->addresses[i].bytes, h_addr_list[i], 4);
++    al->addresses[i].family = AF_INET;
++  }
++
+ 
+   return al;
+ }
+@@ -279,33 +284,29 @@
+   */
+ void
+ wget_sockaddr_set_address (wget_sockaddr *sa, 
+-                         int ip_family, unsigned short port, ip_address *addr)
++                         unsigned short port, ip_address *addr, int family)
+ {
+-  if (ip_family == AF_INET) 
++  if (family == AF_INET)
+     {
+-      sa->sin.sin_family = ip_family;
++      sa->sin.sin_family = AF_INET;



Home | Main Index | Thread Index | Old Index