summaryrefslogtreecommitdiffstats
path: root/ftp
diff options
context:
space:
mode:
authorwill <will@FreeBSD.org>2000-07-02 21:29:54 +0000
committerwill <will@FreeBSD.org>2000-07-02 21:29:54 +0000
commit34122b33b5369d7361ba7fcd58dbcea0d30c8c77 (patch)
tree715be95bdc8e57723db377be04200913e5466a85 /ftp
parentab5276649daf1b4f72458ae90e7fa3e24f3c0342 (diff)
downloadFreeBSD-ports-34122b33b5369d7361ba7fcd58dbcea0d30c8c77.zip
FreeBSD-ports-34122b33b5369d7361ba7fcd58dbcea0d30c8c77.tar.gz
Add patches to allow wget to work with INET6.
Obtained from: NetBSD (thanks itojun!) Approved by: obrien
Diffstat (limited to 'ftp')
-rw-r--r--ftp/wget-devel/Makefile4
-rw-r--r--ftp/wget-devel/files/patch-ai70
-rw-r--r--ftp/wget-devel/files/patch-aj254
-rw-r--r--ftp/wget-devel/files/patch-ak15
-rw-r--r--ftp/wget/Makefile4
-rw-r--r--ftp/wget/files/patch-ai70
-rw-r--r--ftp/wget/files/patch-aj254
-rw-r--r--ftp/wget/files/patch-ak15
8 files changed, 682 insertions, 4 deletions
diff --git a/ftp/wget-devel/Makefile b/ftp/wget-devel/Makefile
index 6fdf4c7..0822efb 100644
--- a/ftp/wget-devel/Makefile
+++ b/ftp/wget-devel/Makefile
@@ -8,7 +8,7 @@
PORTNAME= wget
PORTVERSION= 1.5.3
-CATEGORIES= ftp www
+CATEGORIES= ftp www ipv6
MASTER_SITES= ${MASTER_SITE_GNU} \
ftp://ftp.dl.ac.uk/ccp14/ftp-mirror/wget/pub/unix/util/wget/ \
ftp://ftp.informatik.hu-berlin.de/gnu/wget/ \
@@ -21,7 +21,7 @@ MAINTAINER= obrien@FreeBSD.org
LIB_DEPENDS= intl.1:${PORTSDIR}/devel/gettext
GNU_CONFIGURE= yes
-CONFIGURE_ENV= CPPFLAGS=-I${PREFIX}/include \
+CONFIGURE_ENV+= CPPFLAGS=-I${PREFIX}/include \
LDFLAGS=-L${PREFIX}/lib
pre-build:
diff --git a/ftp/wget-devel/files/patch-ai b/ftp/wget-devel/files/patch-ai
new file mode 100644
index 0000000..3b9a58c
--- /dev/null
+++ b/ftp/wget-devel/files/patch-ai
@@ -0,0 +1,70 @@
+--- src/connect.c.orig Sun Mar 29 23:28:15 1998
++++ src/connect.c Fri Sep 24 15:49:42 1999
+@@ -62,6 +62,59 @@
+ uerr_t
+ make_connection (int *sock, char *hostname, unsigned short port)
+ {
++#ifdef INET6
++ struct sockaddr_storage sock_name;
++ struct sockaddr_in *sin;
++ struct sockaddr_in6 *sin6;
++ size_t socksize;
++
++ /*
++ * Get internet address of the host. We can do it either by calling
++ * ngethostbyname, or by calling store_hostaddress, from host.c.
++ * storehostaddress is better since it caches calls to
++ * gethostbyname.
++ */
++ if (!store_hostaddress (&sock_name, hostname))
++ return HOSTERR;
++
++ /* Set port and protocol */
++ switch (sock_name.ss_family) {
++ case AF_INET:
++ sin = (struct sockaddr_in *) &sock_name;
++ sin->sin_family = AF_INET;
++#ifdef HAVE_SOCKADDR_SA_LEN
++ sin->sin_len = sizeof (struct sockaddr_in);
++#endif
++ sin->sin_port = htons (port);
++ socksize = sizeof (struct sockaddr_in);
++ break;
++ case AF_INET6:
++ sin6 = (struct sockaddr_in6 *) &sock_name;
++ sin6->sin6_family = AF_INET6;
++#ifdef HAVE_SOCKADDR_SA_LEN
++ sin6->sin6_len = sizeof (struct sockaddr_in6);
++#endif
++ sin6->sin6_port = htons (port);
++ socksize = sizeof (struct sockaddr_in6);
++ break;
++ default:
++ return HOSTERR;
++ }
++ /* Make an internet socket, stream type. */
++ if ((*sock = socket (sock_name.ss_family, SOCK_STREAM, 0)) == -1)
++ return CONSOCKERR;
++
++ /* Connect the socket to the remote host. */
++ if (connect (*sock, (struct sockaddr *) &sock_name, socksize))
++ {
++ if (errno == ECONNREFUSED)
++ return CONREFUSED;
++ else
++ return CONERROR;
++ }
++ DEBUGP (("Created fd %d.\n", *sock));
++ return NOCONERROR;
++#else /* !INET6 */
+ struct sockaddr_in sock_name;
+ /* struct hostent *hptr; */
+
+@@ -97,6 +150,7 @@
+ }
+ DEBUGP (("Created fd %d.\n", *sock));
+ return NOCONERROR;
++#endif /* INET6 */
+ }
+
+ /* Bind the local port PORT. This does all the necessary work, which
diff --git a/ftp/wget-devel/files/patch-aj b/ftp/wget-devel/files/patch-aj
new file mode 100644
index 0000000..337c70c
--- /dev/null
+++ b/ftp/wget-devel/files/patch-aj
@@ -0,0 +1,254 @@
+--- src/host.c.orig Mon Sep 21 18:55:42 1998
++++ src/host.c Fri Sep 24 15:49:42 1999
+@@ -75,12 +75,58 @@
+ static struct host *add_hlist PARAMS ((struct host *, const char *,
+ const char *, int));
+
++#ifdef INET6
++/*
++ * The same as gethostbyname2, but supports internet addresses of the
++ * form `N.N.N.N' and 'X:X:X:X:X:X:X:X'.
++ *
++ * Return the pointer of struct hostent on successful finding of the
++ * hostname, NULL pointer otherwise.
++ */
++struct hostent *
++ngethostbyname2 (const char *name, int af)
++{
++ struct hostent *hp = (struct hostent *) NULL;
++ char *addr;
++ size_t socksize;
++
++ /* Support only 2 types address family */
++ if (af != AF_INET6 && af != AF_INET)
++ return (struct hostent *) NULL;
++
++ hp = gethostbyname2(name, af);
++ if (!hp) {
++ if (inet_pton(af, name, addr) != -1) {
++ switch (af) {
++ case AF_INET:
++ socksize = sizeof (struct sockaddr_in);
++ break;
++ case AF_INET6:
++ socksize = sizeof (struct sockaddr_in6);
++ break;
++ }
++ hp = gethostbyaddr(addr, socksize, af);
++ }
++ }
++ return hp;
++}
++#endif /* INET6 */
++
+ /* The same as gethostbyname, but supports internet addresses of the
+ form `N.N.N.N'. */
+ struct hostent *
+ ngethostbyname (const char *name)
+ {
+ struct hostent *hp;
++#ifdef INET6
++ const int af[] = { AF_INET, AF_INET6 };
++ int i;
++
++ for (i = 0; i < 2; i++)
++ if ((hp = ngethostbyname2(name, af[i])) != NULL)
++ return hp;
++ return (struct hostent *) NULL;
++#else
+ unsigned long addr;
+
+ addr = (unsigned long)inet_addr (name);
+@@ -89,6 +135,7 @@
+ else
+ hp = gethostbyname (name);
+ return hp;
++#endif
+ }
+
+ /* Search for HOST in the linked list L, by hostname. Return the
+@@ -117,11 +164,159 @@
+ return NULL;
+ }
+
+-/* Store the address of HOSTNAME, internet-style, to WHERE. First
+- check for it in the host list, and (if not found), use
+- ngethostbyname to get it.
++#ifdef INET6
++int
++convert_hostaddress(int af, const char *hostname, void *address)
++{
++ struct host *t;
++ int valid;
++
++ valid = inet_pton(af, hostname, address);
++ if (valid == -1 || valid == 0) {
++ /* If it is not of that form, try to find it in the cache. */
++ t = search_host (hlist, hostname);
++ if (t)
++ valid = inet_pton(af, t->realname, address);
++ if (valid != -1 && valid != 0)
++ return 1;
++ } else
++ return 1;
++ return 0;
++}
++
++/*
++ * Store the address of HOSTNAME, internet-style, to WHERE. First
++ * check for it in the host list, and (if not found), use
++ * ngethostbyname to get it.
++ *
++ * Return 1 on successful finding of the hostname, 0 otherwise.
++ */
++int
++store_hostaddress (struct sockaddr_storage *where, const char *hostname)
++{
++ struct host *t;
++ struct addrinfo hints, *res;
++ union {
++ struct in_addr in;
++ struct in6_addr in6;
++ } addr_un;
++ struct sockaddr_in *sin;
++ struct sockaddr_in6 *sin6;
++ char *addr_s;
++ char addr_st[INET6_ADDRSTRLEN];
++ int af, valid ,i, err;
++ int family;
++ const int afs[] = { AF_INET6, AF_INET };
++#define MAX_AF 2
+
+- Return 1 on successful finding of the hostname, 0 otherwise. */
++ if (opt.inet)
++ family = AF_INET;
++ else if (opt.inet6)
++ family = AF_INET6;
++ else
++ family = 0;
++ /*
++ * If the address is of the form d.d.d.d, there will be no trouble
++ * with it.
++ */
++ if (!family) {
++ for (i = 0; i < MAX_AF; i++) {
++ valid = convert_hostaddress(afs[i], hostname, &addr_un);
++ af = afs[i];
++ }
++ } else {
++ valid = convert_hostaddress(family, hostname, &addr_un);
++ af = family;
++ }
++ /* If we have the numeric address, just store it. */
++ if (valid) {
++ /* This works on both little and big endian architecture, as
++ * inet_addr returns the address in the proper order. It
++ * appears to work on 64-bit machines too.
++ */
++ switch (af) {
++ case AF_INET:
++ sin = (struct sockaddr_in *) where;
++ memcpy(&sin->sin_addr, &addr_un.in, sizeof(struct in_addr));
++ sin->sin_family = AF_INET;
++ return 1;
++ case AF_INET6:
++ sin6 = (struct sockaddr_in6 *) where;
++ memcpy(&sin6->sin6_addr, &addr_un.in6, sizeof(struct in6_addr));
++ sin6->sin6_family = AF_INET6;
++ return 1;
++ default:
++ return 0;
++ }
++ }
++ /*
++ * Since all else has failed, let's try gethostbyname2(). Note that
++ * we use gethostbyname2() rather than ngethostbyname2(), because we
++ * *know* the address is not numerical.
++ */
++ bzero(&hints, sizeof(hints));
++ hints.ai_socktype = SOCK_STREAM;
++ hints.ai_protocol = 0;
++ if (!family) {
++ hints.ai_family = AF_UNSPEC;
++ } else {
++ hints.ai_family = family;
++ }
++ err = getaddrinfo(hostname, NULL, &hints, &res);
++ if (err) {
++ fprintf(stderr, "%s: %s\n", hostname, gai_strerror(err));
++ return 0;
++ }
++ /*
++ * Copy the address of the host to socket description.
++ */
++ switch (res->ai_family) {
++ case AF_INET:
++ sin = (struct sockaddr_in *) where;
++ memcpy(&sin->sin_addr, &((struct sockaddr_in *)res->ai_addr)->sin_addr, sizeof (struct in_addr));
++ sin->sin_family = AF_INET;
++ memcpy (&addr_un.in.s_addr, &((struct sockaddr_in *)res->ai_addr)->sin_addr, sizeof (addr_un.in));
++ inet_ntop(AF_INET, &addr_un.in, addr_st, sizeof (struct in_addr));
++ STRDUP_ALLOCA (addr_s, addr_st);
++ freeaddrinfo(res);
++ break;
++ case AF_INET6:
++ sin6 = (struct sockaddr_in6 *) where;
++ memcpy(&sin6->sin6_addr, &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr, sizeof (struct in6_addr));
++ sin6->sin6_family = AF_INET6;
++ memcpy (&addr_un.in6, &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr, sizeof (addr_un.in6));
++ inet_ntop(AF_INET6, &addr_un.in6, addr_st, sizeof (struct in6_addr));
++ STRDUP_ALLOCA (addr_s, addr_st);
++ freeaddrinfo(res);
++ break;
++ default:
++ freeaddrinfo(res);
++ return 0;
++ }
++ /*
++ * Now that we're here, we could as well cache the hostname for
++ * future use, as in realhost(). First, we have to look for it by
++ * address to know if it's already in the cache by another name.
++ */
++ /*
++ * Originally, we copied to in.s_addr, but it appears to be missing
++ * on some systems.
++ */
++ t = search_address (hlist, addr_s);
++ if (t) /* Found in the list, as realname. */
++ {
++ /* Set the default, 0 quality. */
++ hlist = add_hlist (hlist, hostname, addr_s, 0);
++ return 1;
++ }
++ /* Since this is really the first time this host is encountered,
++ * set quality to 1.
++ */
++ hlist = add_hlist (hlist, hostname, addr_s, 1);
++ return 1;
++}
++#undef MAX_AF
++#else /* INET6 */
+ int
+ store_hostaddress (unsigned char *where, const char *hostname)
+ {
+@@ -131,8 +326,10 @@
+ struct in_addr in;
+ char *inet_s;
+
+- /* If the address is of the form d.d.d.d, there will be no trouble
+- with it. */
++ /*
++ * If the address is of the form d.d.d.d, there will be no trouble
++ * with it.
++ */
+ addr = (unsigned long)inet_addr (hostname);
+ if ((int)addr == -1)
+ {
+@@ -178,6 +375,7 @@
+ hlist = add_hlist (hlist, hostname, inet_s, 1);
+ return 1;
+ }
++#endif /* INET6 */
+
+ /* Add a host to the host list. The list is sorted by addresses. For
+ equal addresses, the entries with quality should bubble towards the
diff --git a/ftp/wget-devel/files/patch-ak b/ftp/wget-devel/files/patch-ak
new file mode 100644
index 0000000..5390c65
--- /dev/null
+++ b/ftp/wget-devel/files/patch-ak
@@ -0,0 +1,15 @@
+--- src/host.h.orig Sat Jan 31 03:38:01 1998
++++ src/host.h Fri Sep 24 15:49:42 1999
+@@ -25,8 +25,11 @@
+ /* Function declarations */
+
+ struct hostent *ngethostbyname PARAMS ((const char *));
++#ifdef INET6
++int store_hostaddress PARAMS ((struct sockaddr_storage *, const char *));
++#else
+ int store_hostaddress PARAMS ((unsigned char *, const char *));
+-
++#endif
+ void clean_hosts PARAMS ((void));
+
+ char *realhost PARAMS ((const char *));
diff --git a/ftp/wget/Makefile b/ftp/wget/Makefile
index 6fdf4c7..0822efb 100644
--- a/ftp/wget/Makefile
+++ b/ftp/wget/Makefile
@@ -8,7 +8,7 @@
PORTNAME= wget
PORTVERSION= 1.5.3
-CATEGORIES= ftp www
+CATEGORIES= ftp www ipv6
MASTER_SITES= ${MASTER_SITE_GNU} \
ftp://ftp.dl.ac.uk/ccp14/ftp-mirror/wget/pub/unix/util/wget/ \
ftp://ftp.informatik.hu-berlin.de/gnu/wget/ \
@@ -21,7 +21,7 @@ MAINTAINER= obrien@FreeBSD.org
LIB_DEPENDS= intl.1:${PORTSDIR}/devel/gettext
GNU_CONFIGURE= yes
-CONFIGURE_ENV= CPPFLAGS=-I${PREFIX}/include \
+CONFIGURE_ENV+= CPPFLAGS=-I${PREFIX}/include \
LDFLAGS=-L${PREFIX}/lib
pre-build:
diff --git a/ftp/wget/files/patch-ai b/ftp/wget/files/patch-ai
new file mode 100644
index 0000000..3b9a58c
--- /dev/null
+++ b/ftp/wget/files/patch-ai
@@ -0,0 +1,70 @@
+--- src/connect.c.orig Sun Mar 29 23:28:15 1998
++++ src/connect.c Fri Sep 24 15:49:42 1999
+@@ -62,6 +62,59 @@
+ uerr_t
+ make_connection (int *sock, char *hostname, unsigned short port)
+ {
++#ifdef INET6
++ struct sockaddr_storage sock_name;
++ struct sockaddr_in *sin;
++ struct sockaddr_in6 *sin6;
++ size_t socksize;
++
++ /*
++ * Get internet address of the host. We can do it either by calling
++ * ngethostbyname, or by calling store_hostaddress, from host.c.
++ * storehostaddress is better since it caches calls to
++ * gethostbyname.
++ */
++ if (!store_hostaddress (&sock_name, hostname))
++ return HOSTERR;
++
++ /* Set port and protocol */
++ switch (sock_name.ss_family) {
++ case AF_INET:
++ sin = (struct sockaddr_in *) &sock_name;
++ sin->sin_family = AF_INET;
++#ifdef HAVE_SOCKADDR_SA_LEN
++ sin->sin_len = sizeof (struct sockaddr_in);
++#endif
++ sin->sin_port = htons (port);
++ socksize = sizeof (struct sockaddr_in);
++ break;
++ case AF_INET6:
++ sin6 = (struct sockaddr_in6 *) &sock_name;
++ sin6->sin6_family = AF_INET6;
++#ifdef HAVE_SOCKADDR_SA_LEN
++ sin6->sin6_len = sizeof (struct sockaddr_in6);
++#endif
++ sin6->sin6_port = htons (port);
++ socksize = sizeof (struct sockaddr_in6);
++ break;
++ default:
++ return HOSTERR;
++ }
++ /* Make an internet socket, stream type. */
++ if ((*sock = socket (sock_name.ss_family, SOCK_STREAM, 0)) == -1)
++ return CONSOCKERR;
++
++ /* Connect the socket to the remote host. */
++ if (connect (*sock, (struct sockaddr *) &sock_name, socksize))
++ {
++ if (errno == ECONNREFUSED)
++ return CONREFUSED;
++ else
++ return CONERROR;
++ }
++ DEBUGP (("Created fd %d.\n", *sock));
++ return NOCONERROR;
++#else /* !INET6 */
+ struct sockaddr_in sock_name;
+ /* struct hostent *hptr; */
+
+@@ -97,6 +150,7 @@
+ }
+ DEBUGP (("Created fd %d.\n", *sock));
+ return NOCONERROR;
++#endif /* INET6 */
+ }
+
+ /* Bind the local port PORT. This does all the necessary work, which
diff --git a/ftp/wget/files/patch-aj b/ftp/wget/files/patch-aj
new file mode 100644
index 0000000..337c70c
--- /dev/null
+++ b/ftp/wget/files/patch-aj
@@ -0,0 +1,254 @@
+--- src/host.c.orig Mon Sep 21 18:55:42 1998
++++ src/host.c Fri Sep 24 15:49:42 1999
+@@ -75,12 +75,58 @@
+ static struct host *add_hlist PARAMS ((struct host *, const char *,
+ const char *, int));
+
++#ifdef INET6
++/*
++ * The same as gethostbyname2, but supports internet addresses of the
++ * form `N.N.N.N' and 'X:X:X:X:X:X:X:X'.
++ *
++ * Return the pointer of struct hostent on successful finding of the
++ * hostname, NULL pointer otherwise.
++ */
++struct hostent *
++ngethostbyname2 (const char *name, int af)
++{
++ struct hostent *hp = (struct hostent *) NULL;
++ char *addr;
++ size_t socksize;
++
++ /* Support only 2 types address family */
++ if (af != AF_INET6 && af != AF_INET)
++ return (struct hostent *) NULL;
++
++ hp = gethostbyname2(name, af);
++ if (!hp) {
++ if (inet_pton(af, name, addr) != -1) {
++ switch (af) {
++ case AF_INET:
++ socksize = sizeof (struct sockaddr_in);
++ break;
++ case AF_INET6:
++ socksize = sizeof (struct sockaddr_in6);
++ break;
++ }
++ hp = gethostbyaddr(addr, socksize, af);
++ }
++ }
++ return hp;
++}
++#endif /* INET6 */
++
+ /* The same as gethostbyname, but supports internet addresses of the
+ form `N.N.N.N'. */
+ struct hostent *
+ ngethostbyname (const char *name)
+ {
+ struct hostent *hp;
++#ifdef INET6
++ const int af[] = { AF_INET, AF_INET6 };
++ int i;
++
++ for (i = 0; i < 2; i++)
++ if ((hp = ngethostbyname2(name, af[i])) != NULL)
++ return hp;
++ return (struct hostent *) NULL;
++#else
+ unsigned long addr;
+
+ addr = (unsigned long)inet_addr (name);
+@@ -89,6 +135,7 @@
+ else
+ hp = gethostbyname (name);
+ return hp;
++#endif
+ }
+
+ /* Search for HOST in the linked list L, by hostname. Return the
+@@ -117,11 +164,159 @@
+ return NULL;
+ }
+
+-/* Store the address of HOSTNAME, internet-style, to WHERE. First
+- check for it in the host list, and (if not found), use
+- ngethostbyname to get it.
++#ifdef INET6
++int
++convert_hostaddress(int af, const char *hostname, void *address)
++{
++ struct host *t;
++ int valid;
++
++ valid = inet_pton(af, hostname, address);
++ if (valid == -1 || valid == 0) {
++ /* If it is not of that form, try to find it in the cache. */
++ t = search_host (hlist, hostname);
++ if (t)
++ valid = inet_pton(af, t->realname, address);
++ if (valid != -1 && valid != 0)
++ return 1;
++ } else
++ return 1;
++ return 0;
++}
++
++/*
++ * Store the address of HOSTNAME, internet-style, to WHERE. First
++ * check for it in the host list, and (if not found), use
++ * ngethostbyname to get it.
++ *
++ * Return 1 on successful finding of the hostname, 0 otherwise.
++ */
++int
++store_hostaddress (struct sockaddr_storage *where, const char *hostname)
++{
++ struct host *t;
++ struct addrinfo hints, *res;
++ union {
++ struct in_addr in;
++ struct in6_addr in6;
++ } addr_un;
++ struct sockaddr_in *sin;
++ struct sockaddr_in6 *sin6;
++ char *addr_s;
++ char addr_st[INET6_ADDRSTRLEN];
++ int af, valid ,i, err;
++ int family;
++ const int afs[] = { AF_INET6, AF_INET };
++#define MAX_AF 2
+
+- Return 1 on successful finding of the hostname, 0 otherwise. */
++ if (opt.inet)
++ family = AF_INET;
++ else if (opt.inet6)
++ family = AF_INET6;
++ else
++ family = 0;
++ /*
++ * If the address is of the form d.d.d.d, there will be no trouble
++ * with it.
++ */
++ if (!family) {
++ for (i = 0; i < MAX_AF; i++) {
++ valid = convert_hostaddress(afs[i], hostname, &addr_un);
++ af = afs[i];
++ }
++ } else {
++ valid = convert_hostaddress(family, hostname, &addr_un);
++ af = family;
++ }
++ /* If we have the numeric address, just store it. */
++ if (valid) {
++ /* This works on both little and big endian architecture, as
++ * inet_addr returns the address in the proper order. It
++ * appears to work on 64-bit machines too.
++ */
++ switch (af) {
++ case AF_INET:
++ sin = (struct sockaddr_in *) where;
++ memcpy(&sin->sin_addr, &addr_un.in, sizeof(struct in_addr));
++ sin->sin_family = AF_INET;
++ return 1;
++ case AF_INET6:
++ sin6 = (struct sockaddr_in6 *) where;
++ memcpy(&sin6->sin6_addr, &addr_un.in6, sizeof(struct in6_addr));
++ sin6->sin6_family = AF_INET6;
++ return 1;
++ default:
++ return 0;
++ }
++ }
++ /*
++ * Since all else has failed, let's try gethostbyname2(). Note that
++ * we use gethostbyname2() rather than ngethostbyname2(), because we
++ * *know* the address is not numerical.
++ */
++ bzero(&hints, sizeof(hints));
++ hints.ai_socktype = SOCK_STREAM;
++ hints.ai_protocol = 0;
++ if (!family) {
++ hints.ai_family = AF_UNSPEC;
++ } else {
++ hints.ai_family = family;
++ }
++ err = getaddrinfo(hostname, NULL, &hints, &res);
++ if (err) {
++ fprintf(stderr, "%s: %s\n", hostname, gai_strerror(err));
++ return 0;
++ }
++ /*
++ * Copy the address of the host to socket description.
++ */
++ switch (res->ai_family) {
++ case AF_INET:
++ sin = (struct sockaddr_in *) where;
++ memcpy(&sin->sin_addr, &((struct sockaddr_in *)res->ai_addr)->sin_addr, sizeof (struct in_addr));
++ sin->sin_family = AF_INET;
++ memcpy (&addr_un.in.s_addr, &((struct sockaddr_in *)res->ai_addr)->sin_addr, sizeof (addr_un.in));
++ inet_ntop(AF_INET, &addr_un.in, addr_st, sizeof (struct in_addr));
++ STRDUP_ALLOCA (addr_s, addr_st);
++ freeaddrinfo(res);
++ break;
++ case AF_INET6:
++ sin6 = (struct sockaddr_in6 *) where;
++ memcpy(&sin6->sin6_addr, &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr, sizeof (struct in6_addr));
++ sin6->sin6_family = AF_INET6;
++ memcpy (&addr_un.in6, &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr, sizeof (addr_un.in6));
++ inet_ntop(AF_INET6, &addr_un.in6, addr_st, sizeof (struct in6_addr));
++ STRDUP_ALLOCA (addr_s, addr_st);
++ freeaddrinfo(res);
++ break;
++ default:
++ freeaddrinfo(res);
++ return 0;
++ }
++ /*
++ * Now that we're here, we could as well cache the hostname for
++ * future use, as in realhost(). First, we have to look for it by
++ * address to know if it's already in the cache by another name.
++ */
++ /*
++ * Originally, we copied to in.s_addr, but it appears to be missing
++ * on some systems.
++ */
++ t = search_address (hlist, addr_s);
++ if (t) /* Found in the list, as realname. */
++ {
++ /* Set the default, 0 quality. */
++ hlist = add_hlist (hlist, hostname, addr_s, 0);
++ return 1;
++ }
++ /* Since this is really the first time this host is encountered,
++ * set quality to 1.
++ */
++ hlist = add_hlist (hlist, hostname, addr_s, 1);
++ return 1;
++}
++#undef MAX_AF
++#else /* INET6 */
+ int
+ store_hostaddress (unsigned char *where, const char *hostname)
+ {
+@@ -131,8 +326,10 @@
+ struct in_addr in;
+ char *inet_s;
+
+- /* If the address is of the form d.d.d.d, there will be no trouble
+- with it. */
++ /*
++ * If the address is of the form d.d.d.d, there will be no trouble
++ * with it.
++ */
+ addr = (unsigned long)inet_addr (hostname);
+ if ((int)addr == -1)
+ {
+@@ -178,6 +375,7 @@
+ hlist = add_hlist (hlist, hostname, inet_s, 1);
+ return 1;
+ }
++#endif /* INET6 */
+
+ /* Add a host to the host list. The list is sorted by addresses. For
+ equal addresses, the entries with quality should bubble towards the
diff --git a/ftp/wget/files/patch-ak b/ftp/wget/files/patch-ak
new file mode 100644
index 0000000..5390c65
--- /dev/null
+++ b/ftp/wget/files/patch-ak
@@ -0,0 +1,15 @@
+--- src/host.h.orig Sat Jan 31 03:38:01 1998
++++ src/host.h Fri Sep 24 15:49:42 1999
+@@ -25,8 +25,11 @@
+ /* Function declarations */
+
+ struct hostent *ngethostbyname PARAMS ((const char *));
++#ifdef INET6
++int store_hostaddress PARAMS ((struct sockaddr_storage *, const char *));
++#else
+ int store_hostaddress PARAMS ((unsigned char *, const char *));
+-
++#endif
+ void clean_hosts PARAMS ((void));
+
+ char *realhost PARAMS ((const char *));
OpenPOWER on IntegriCloud