rpms/c-ares/devel 0001-Allow-the-use-of-IPv6-nameservers.patch, 1.1, 1.2 c-ares.spec, 1.19, 1.20
Jakub Hrozek
jhrozek at fedoraproject.org
Sun Mar 7 19:53:55 UTC 2010
Author: jhrozek
Update of /cvs/pkgs/rpms/c-ares/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv7582
Modified Files:
0001-Allow-the-use-of-IPv6-nameservers.patch c-ares.spec
Log Message:
change IPv6 nameserver patch according to upstream
0001-Allow-the-use-of-IPv6-nameservers.patch:
Makefile.inc | 6
adig.c | 103 +++++++++++++---
ahost.c | 4
ares.h | 19 ++
ares__get_hostent.c | 12 -
ares_data.c | 13 ++
ares_data.h | 6
ares_destroy.c | 35 +++--
ares_free_data.3 | 14 +-
ares_gethostbyaddr.c | 20 +--
ares_gethostbyname.c | 24 ++-
ares_getnameinfo.c | 14 +-
ares_init.3 | 18 +-
ares_init.c | 307 +++++++++++++++++++++++++++++++++++-------------
ares_ipv6.h | 21 ---
ares_parse_aaaa_reply.c | 18 +-
ares_private.h | 22 +--
ares_process.c | 125 ++++++++++++++++---
ares_save_options.3 | 13 +-
inet_net_pton.c | 5
inet_ntop.c | 3
vc/cares/vc6cares.dsp | 5
22 files changed, 590 insertions(+), 217 deletions(-)
View full diff with command:
/usr/bin/cvs -n -f diff -kk -u -p -N -r 1.1 -r 1.2 0001-Allow-the-use-of-IPv6-nameservers.patchIndex: 0001-Allow-the-use-of-IPv6-nameservers.patch
===================================================================
RCS file: /cvs/pkgs/rpms/c-ares/devel/0001-Allow-the-use-of-IPv6-nameservers.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- 0001-Allow-the-use-of-IPv6-nameservers.patch 4 Mar 2010 11:05:26 -0000 1.1
+++ 0001-Allow-the-use-of-IPv6-nameservers.patch 7 Mar 2010 19:53:55 -0000 1.2
@@ -1,78 +1,435 @@
-From 1f1893a428376810f2c2887cf51ca7891917b216 Mon Sep 17 00:00:00 2001
+From a9794547f61ccca1cdf71949f3f7183387300a7a Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
-Date: Mon, 1 Feb 2010 21:23:59 +0100
-Subject: [PATCH 1/2] Allow the use of IPv6 nameservers
+Date: Sun, 7 Mar 2010 18:37:47 +0100
+Subject: [PATCH] IPv6 nameserver patch
-This patch allows the use of IPv6 addresses for nameserves in both
-/etc/resolv.conf and by using the ares_set_nameservers() API.
---
- Makefile.inc | 3 +
- ares.h | 13 +++
- ares_destroy.c | 10 +--
- ares_init.c | 208 ++++++++++++++++++++++++++++++++++++++---------
- ares_private.h | 13 +--
- ares_process.c | 95 +++++++++++++++++-----
- ares_set_nameservers.3 | 58 +++++++++++++
- 7 files changed, 320 insertions(+), 80 deletions(-)
- create mode 100644 ares_set_nameservers.3
+ Makefile.inc | 6 +
+ adig.c | 103 +++++++++++++---
+ ahost.c | 4 +-
+ ares.h | 19 +++-
+ ares__get_hostent.c | 12 +-
+ ares_data.c | 13 ++
+ ares_data.h | 6 +-
+ ares_destroy.c | 35 ++++--
+ ares_free_data.3 | 14 ++-
+ ares_gethostbyaddr.c | 20 ++--
+ ares_gethostbyname.c | 24 ++--
+ ares_getnameinfo.c | 14 ++-
+ ares_init.3 | 18 ++-
+ ares_init.c | 307 +++++++++++++++++++++++++++++++++++------------
+ ares_ipv6.h | 21 +---
+ ares_parse_aaaa_reply.c | 18 ++--
+ ares_private.h | 22 ++--
+ ares_process.c | 125 ++++++++++++++++---
+ ares_save_options.3 | 13 ++-
+ inet_net_pton.c | 5 +-
+ inet_ntop.c | 3 +-
+ vc/cares/vc6cares.dsp | 4 +
+ 22 files changed, 590 insertions(+), 216 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
-index 3227858..8e575fd 100644
+index 3227858..365de6c 100644
--- a/Makefile.inc
+++ b/Makefile.inc
-@@ -92,6 +92,7 @@ MANPAGES = ares_cancel.3 \
+@@ -70,6 +70,7 @@ MANPAGES = ares_cancel.3 \
+ ares_free_data.3 \
+ ares_free_hostent.3 \
+ ares_free_string.3 \
++ ares_get_servers.3 \
+ ares_gethostbyaddr.3 \
+ ares_gethostbyname.3 \
+ ares_gethostbyname_file.3 \
+@@ -91,6 +92,7 @@ MANPAGES = ares_cancel.3 \
+ ares_save_options.3 \
ares_search.3 \
ares_send.3 \
++ ares_set_servers.3 \
ares_set_socket_callback.3 \
-+ ares_set_nameservers.3 \
ares_strerror.3 \
ares_timeout.3 \
- ares_version.3
-@@ -128,6 +129,7 @@ HTMLPAGES = ares_cancel.html \
+@@ -106,6 +108,7 @@ HTMLPAGES = ares_cancel.html \
+ ares_free_data.html \
+ ares_free_hostent.html \
+ ares_free_string.html \
++ ares_get_servers.html \
+ ares_gethostbyaddr.html \
+ ares_gethostbyname.html \
+ ares_gethostbyname_file.html \
+@@ -127,6 +130,7 @@ HTMLPAGES = ares_cancel.html \
+ ares_save_options.html \
ares_search.html \
ares_send.html \
++ ares_set_servers.html \
ares_set_socket_callback.html \
-+ ares_set_nameservers.html \
ares_strerror.html \
ares_timeout.html \
- ares_version.html
-@@ -164,6 +166,7 @@ PDFPAGES = ares_cancel.pdf \
+@@ -142,6 +146,7 @@ PDFPAGES = ares_cancel.pdf \
+ ares_free_data.pdf \
+ ares_free_hostent.pdf \
+ ares_free_string.pdf \
++ ares_get_servers.pdf \
+ ares_gethostbyaddr.pdf \
+ ares_gethostbyname.pdf \
+ ares_gethostbyname_file.pdf \
+@@ -163,6 +168,7 @@ PDFPAGES = ares_cancel.pdf \
+ ares_save_options.pdf \
ares_search.pdf \
ares_send.pdf \
++ ares_set_servers.pdf \
ares_set_socket_callback.pdf \
-+ ares_set_nameservers.pdf \
ares_strerror.pdf \
ares_timeout.pdf \
- ares_version.pdf
+diff --git a/adig.c b/adig.c
+index 8897448..d827e0e 100644
+--- a/adig.c
++++ b/adig.c
+@@ -1,6 +1,6 @@
+ /* Copyright 1998 by the Massachusetts Institute of Technology.
+ *
+- * $Id$
++ * $Id$
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+@@ -164,8 +164,6 @@ static const char *rcodes[] = {
+ "(unknown)", "(unknown)", "(unknown)", "(unknown)", "NOCHANGE"
+ };
+
+-static struct in_addr inaddr;
+-
+ static void callback(void *arg, int status, int timeouts,
+ unsigned char *abuf, int alen);
+ static const unsigned char *display_question(const unsigned char *aptr,
+@@ -176,6 +174,9 @@ static const unsigned char *display_rr(const unsigned char *aptr,
+ static const char *type_name(int type);
+ static const char *class_name(int dnsclass);
+ static void usage(void);
++static void destroy_addr_list(struct ares_addr_node *head);
++static void append_addr_list(struct ares_addr_node **head,
++ struct ares_addr_node *node);
+
+ int main(int argc, char **argv)
+ {
+@@ -186,6 +187,7 @@ int main(int argc, char **argv)
+ struct hostent *hostent;
+ fd_set read_fds, write_fds;
+ struct timeval *tvp, tv;
++ struct ares_addr_node *srvr, *servers = NULL;
+
+ #ifdef USE_WINSOCK
+ WORD wVersionRequested = MAKEWORD(USE_WINSOCK,USE_WINSOCK);
+@@ -227,27 +229,56 @@ int main(int argc, char **argv)
+ break;
+
+ case 's':
+- /* Add a server, and specify servers in the option mask. */
+- if (ares_inet_pton(AF_INET, optarg, &inaddr) <= 0)
++ /* User specified name servers override default ones. */
++ srvr = malloc(sizeof(struct ares_addr_node));
++ if (!srvr)
++ {
++ fprintf(stderr, "Out of memory!\n");
++ destroy_addr_list(servers);
++ return 1;
++ }
++ append_addr_list(&servers, srvr);
++ if (ares_inet_pton(AF_INET, optarg, &srvr->addr.addr4) > 0)
++ srvr->family = AF_INET;
++ else if (ares_inet_pton(AF_INET6, optarg, &srvr->addr.addr6) > 0)
++ srvr->family = AF_INET6;
++ else
+ {
+ hostent = gethostbyname(optarg);
+- if (!hostent || hostent->h_addrtype != AF_INET)
++ if (!hostent)
+ {
+ fprintf(stderr, "adig: server %s not found.\n", optarg);
++ destroy_addr_list(servers);
+ return 1;
+ }
+- memcpy(&inaddr, hostent->h_addr, sizeof(struct in_addr));
+- }
+- options.servers = realloc(options.servers, (options.nservers + 1)
+- * sizeof(struct in_addr));
+- if (!options.servers)
+- {
+- fprintf(stderr, "Out of memory!\n");
+- return 1;
++ switch (hostent->h_addrtype)
++ {
++ case AF_INET:
++ srvr->family = AF_INET;
++ memcpy(&srvr->addr.addr4, hostent->h_addr,
++ sizeof(srvr->addr.addr4));
++ break;
++ case AF_INET6:
++ srvr->family = AF_INET6;
[...1628 lines suppressed...]
-index 0000000..f573790
---- /dev/null
-+++ b/ares_set_nameservers.3
-@@ -0,0 +1,58 @@
-+.TH ARES_SET_NAMESERVERS 3 "12 Feb 2010"
-+.SH NAME
-+ares_set_nameservers - Set nameservers
-+.SH SYNOPSIS
-+.nf
-+.B #include <ares.h>
-+.PP
-+.B int ares_set_nameservers(ares_channel \fIchannel\fP,
-+ struct ares_addr *\fIservers\fP,
-+ int \fInum_servers\fP)
-+.PP
-+.B cc file.c -lcares
-+.fi
-+.SH DESCRIPTION
-+.PP
-+This function sets nameservers for the given ares channel handle.
-+The array
-+.I servers
-+contains the addresses of nameservers, the length of the array
-+is stored in the
-+.I num_servers
-+parameter.
-+Contrary to initializing nameservers with
-+.B ares_init_options
-+this function can be used to set IPv6 nameservers.
-+
-+The structure
-+.I ares_addr
-+contains the following fields:
-+.sp
-+.in +4n
-+.nf
-+struct ares_addr {
-+ int family;
-+ union {
-+ struct in_addr addr4;
-+ struct in6_addr addr6;
-+ } addr;
-+};
-+.fi
-+.in
+@@ -1079,6 +1136,34 @@ static int same_questions(const unsigned char *qbuf, int qlen,
+ return 1;
+ }
+
++static int same_address(struct sockaddr *sa, struct ares_addr *aa)
++{
++ void *addr1;
++ void *addr2;
+
-+.PP
-+.SH RETURN VALUES
-+.B ares_set_nameservers
-+can return any of the following values:
-+.TP 15
-+.B ARES_SUCCESS
-+The response was successfully parsed.
-+.TP 15
-+.B ARES_ENOMEM
-+Memory was exhausted.
-+.SH SEE ALSO
-+.BR ares_init_options (3)
-+.SH AUTHOR
-+Written by Jakub Hrozek <jhrozek at redhat.com>,
-+on behalf of Red Hat, Inc http://www.redhat.com
++ if (sa->sa_family == aa->family)
++ {
++ switch (aa->family)
++ {
++ case AF_INET:
++ addr1 = &aa->addrV4;
++ addr2 = &((struct sockaddr_in *)sa)->sin_addr;
++ if (memcmp(addr1, addr2, sizeof(aa->addrV4)) == 0)
++ return 1; /* match */
++ break;
++ case AF_INET6:
++ addr1 = &aa->addrV6;
++ addr2 = &((struct sockaddr_in6 *)sa)->sin6_addr;
++ if (memcmp(addr1, addr2, sizeof(aa->addrV6)) == 0)
++ return 1; /* match */
++ break;
++ default:
++ break;
++ }
++ }
++ return 0; /* different */
++}
+
+ static void end_query (ares_channel channel, struct query *query, int status,
+ unsigned char *abuf, int alen)
+ {
+diff --git a/ares_save_options.3 b/ares_save_options.3
+index 268327c..8ed8925 100644
+--- a/ares_save_options.3
++++ b/ares_save_options.3
+@@ -1,4 +1,4 @@
+-.\" $Id$
++.\" $Id$
+ .\"
+ .\" Copyright 1998 by the Massachusetts Institute of Technology.
+ .\"
+@@ -14,7 +14,7 @@
+ .\" this software for any purpose. It is provided "as is"
+ .\" without express or implied warranty.
+ .\"
+-.TH ARES_SAVE_OPTIONS 3 "1 June 2007"
++.TH ARES_SAVE_OPTIONS 3 "5 March 2010"
+ .SH NAME
+ ares_save_options \- Save configuration values obtained from initialized ares_channel
+ .SH SYNOPSIS
+@@ -52,13 +52,20 @@ The channel data identified by
+ were invalid.
+ .SH NOTE
+ Since c-ares 1.6.0 the ares_options struct has been "locked" meaning that it
+-won't be extended to cover new funtions. This function will remain
++won't be extended to cover new functions. This function will remain
+ functioning, but it can only return config data that can be represented in
+ this config struct, which may no longer be the complete set of config
+ options. \fBares_dup(3)\fP will not have that restriction.
++
++The ares_options struct can not handle potential IPv6 name servers the
++ares_channel might be configured to use. Function \fBares_save_options(3)\fP
++will only return IPv4 servers if any. In order to retrieve all name servers
++an ares_channel might be using, function \fBares_get_servers(3)\fP must be
++used instead.
+ .SH SEE ALSO
+ .BR ares_destroy_options (3),
+ .BR ares_init_options (3),
++.BR ares_get_servers (3),
+ .BR ares_dup (3)
+ .SH AVAILABILITY
+ ares_save_options(3) was added in c-ares 1.4.0
+diff --git a/inet_net_pton.c b/inet_net_pton.c
+index de09ace..f4a0812 100644
+--- a/inet_net_pton.c
++++ b/inet_net_pton.c
+@@ -1,4 +1,4 @@
+-/* $Id$ */
++/* $Id$ */
+
+ /*
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+@@ -43,6 +43,7 @@
+ #include <string.h>
+ #include <stdlib.h>
+
++#include "ares.h"
+ #include "ares_ipv6.h"
+ #include "inet_net_pton.h"
+
+@@ -432,7 +433,7 @@ int ares_inet_pton(int af, const char *src, void *dst)
+ if (af == AF_INET)
+ size = sizeof(struct in_addr);
+ else if (af == AF_INET6)
+- size = sizeof(struct in6_addr);
++ size = sizeof(struct ares_in6_addr);
+ else
+ {
+ SET_ERRNO(EAFNOSUPPORT);
+diff --git a/inet_ntop.c b/inet_ntop.c
+index 5b0d097..31b9ab1 100644
+--- a/inet_ntop.c
++++ b/inet_ntop.c
+@@ -1,4 +1,4 @@
+-/* $Id$ */
++/* $Id$ */
+
+ /* Copyright (c) 1996 by Internet Software Consortium.
+ *
+@@ -42,6 +42,7 @@
+ #include <string.h>
+ #include <stdlib.h>
+
++#include "ares.h"
+ #include "ares_ipv6.h"
+ #include "inet_ntop.h"
+
+diff --git a/vc/cares/vc6cares.dsp b/vc/cares/vc6cares.dsp
+index b7c50c6..583a55c 100644
+--- a/vc/cares/vc6cares.dsp
++++ b/vc/cares/vc6cares.dsp
+@@ -226,6 +226,10 @@ SOURCE=..\..\ares_mkquery.c
+ # End Source File
+ # Begin Source File
+
++SOURCE=..\..\ares_options.c
++# End Source File
++# Begin Source File
++
+ SOURCE=..\..\ares_parse_a_reply.c
+ # End Source File
+ # Begin Source File
--
-1.6.6
+1.6.6.1
Index: c-ares.spec
===================================================================
RCS file: /cvs/pkgs/rpms/c-ares/devel/c-ares.spec,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -p -r1.19 -r1.20
--- c-ares.spec 4 Mar 2010 11:05:27 -0000 1.19
+++ c-ares.spec 7 Mar 2010 19:53:55 -0000 1.20
@@ -1,7 +1,7 @@
Summary: A library that performs asynchronous DNS operations
Name: c-ares
Version: 1.7.0
-Release: 2%{?dist}
+Release: 3%{?dist}
License: MIT
Group: System Environment/Libraries
URL: http://c-ares.haxx.se/
@@ -66,6 +66,10 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man3/ares_*
%changelog
+* Sun Mar 7 2010 Jakub Hrozek <jhrozek at redhat.com> - 1.7.0-3
+- Change IPv6 nameserver patch according to upstream changes
+ (upstream revisions 1199,1201,1202)
+
* Wed Mar 3 2010 Jakub Hrozek <jhrozek at redhat.com> - 1.7.0-2
- Add a patch to allow usage of IPv6 nameservers
More information about the scm-commits
mailing list