ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/mports/trunk/dns/c-ares/files/ares-config-info.patch
(Generate patch)

Comparing trunk/dns/c-ares/files/ares-config-info.patch (file contents):
Revision 9996 by laffer1, Sat Aug 1 21:09:32 2009 UTC vs.
Revision 9997 by laffer1, Sat Sep 18 18:16:45 2010 UTC

# Line 1 | Line 1
1 < Add the ares_get_config() routine used by Unreal IRCd.
1 > Description: Add the ares_get_config() routine used by Unreal IRCd.
2 > Originally taken from the Unreal IRCd distribution, later modified
3 > by me to properly support IPv6 nameserver addresses since c-ares-1.7.1.
4 > Origin: the Unreal IRCd distribution
5 > Author: Peter Pentchev <roam@FreeBSD.org>
6 > Forwarded: no
7 > Last-Update: 2010-06-11
8  
9   --- ares.h.orig
10   +++ ares.h
11 < @@ -218,6 +218,14 @@
11 > @@ -260,6 +260,14 @@
12     int nsort;
13   };
14  
# Line 17 | Line 23 | Add the ares_get_config() routine used by Unreal IRCd.
23   struct hostent;
24   struct timeval;
25   struct sockaddr;
26 < @@ -313,7 +321,7 @@
27 < void ares_free_string(void *str);
28 < void ares_free_hostent(struct hostent *host);
29 < const char *ares_strerror(int code);
30 < -
31 < +int ares_get_config(struct ares_config_info *d, ares_channel c);
26 > @@ -511,6 +519,8 @@
27 > CARES_EXTERN int ares_get_servers(ares_channel channel,
28 >                                   struct ares_addr_node **servers);
29 >
30 > +CARES_EXTERN int ares_get_config(struct ares_config_info *d, ares_channel c);
31 > +
32   #ifdef  __cplusplus
33   }
34   #endif
35   --- ares_init.c.orig
36   +++ ares_init.c
37 < @@ -1478,6 +1478,26 @@
38 <     pat->mask.addr4.s_addr = htonl(IN_CLASSC_NET);
37 > @@ -66,6 +66,7 @@
38 > #include <errno.h>
39 > #include "ares.h"
40 > #include "inet_net_pton.h"
41 > +#include "inet_ntop.h"
42 > #include "ares_library_init.h"
43 > #include "ares_private.h"
44 >
45 > @@ -1519,6 +1520,36 @@
46   }
47 < #endif
48 < +
47 > #endif /* !WIN32 && !WATT32 */
48 >
49   +int ares_get_config(struct ares_config_info *d, ares_channel c)
50   +{
51 < +int i;
52 < +char *p;
51 > +       int i;
52 > +       const char *p;
53 > +       char tmp[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
54   +
55   +       memset(d, 0, sizeof(struct ares_config_info));
56   +
# Line 46 | Line 60 | Add the ares_get_config() routine used by Unreal IRCd.
60   +       d->servers = calloc(sizeof(char *), c->nservers);
61   +       for (i = 0; i < c->nservers; i++)
62   +       {
63 < +               p = inet_ntoa(c->servers[i].addr);
63 > +               if (c->servers[i].addr.family == AF_INET)
64 > +                       p = ares_inet_ntop(c->servers[i].addr.family,
65 > +                           (const char *)&c->servers[i].addr.addrV4,
66 > +                           tmp, sizeof(tmp));
67 > +               else if (c->servers[i].addr.family == AF_INET6)
68 > +                       p = ares_inet_ntop(c->servers[i].addr.family,
69 > +                           (const char *)&c->servers[i].addr.addrV6,
70 > +                           tmp, sizeof(tmp));
71 > +               else
72 > +                       p = NULL;
73   +               d->servers[i] = p ? strdup(p) : NULL;
74   +       }
75   +
76   +       return ARES_SUCCESS;
77   +}
78 + +
79   /* initialize an rc4 key. If possible a cryptographically secure random key
80      is generated using a suitable function (for example win32's RtlGenRandom as
81      described in

Comparing trunk/dns/c-ares/files/ares-config-info.patch (property cvs2svn:cvs-rev):
Revision 9996 by laffer1, Sat Aug 1 21:09:32 2009 UTC vs.
Revision 9997 by laffer1, Sat Sep 18 18:16:45 2010 UTC

# Line 1 | Line 1
1 < 1.2
1 > 1.3

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines