aboutsummaryrefslogtreecommitdiff
path: root/resolv
diff options
context:
space:
mode:
authorPetar Bogdanovic <petar@smokva.net>2009-10-29 08:17:48 -0700
committerUlrich Drepper <drepper@redhat.com>2009-10-29 08:17:48 -0700
commit3a85895fa3e15b8d53856161a4ba3950d44ea285 (patch)
tree9a5fa5f887ad9f2da02ff4598b5d400a9cae80aa /resolv
parent3ad3a4d0593be70f99a94b009afa76a6dc3f0a17 (diff)
downloadglibc-3a85895fa3e15b8d53856161a4ba3950d44ea285.zip
glibc-3a85895fa3e15b8d53856161a4ba3950d44ea285.tar.gz
glibc-3a85895fa3e15b8d53856161a4ba3950d44ea285.tar.bz2
Fix mixing IPv4 and IPv6 name server in resolv.conf.
Diffstat (limited to 'resolv')
-rw-r--r--resolv/res_send.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 4c14db1..fa48bd9 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -219,33 +219,33 @@ res_ourserver_p(const res_state statp, const struct sockaddr_in6 *inp)
{
int ns;
- if (inp->sin6_family == AF_INET) {
- struct sockaddr_in *in4p = (struct sockaddr_in *) inp;
+ if (inp->sin6_family == AF_INET) {
+ struct sockaddr_in *in4p = (struct sockaddr_in *) inp;
in_port_t port = in4p->sin_port;
in_addr_t addr = in4p->sin_addr.s_addr;
- for (ns = 0; ns < MAXNS; ns++) {
- const struct sockaddr_in *srv =
+ for (ns = 0; ns < MAXNS; ns++) {
+ const struct sockaddr_in *srv =
(struct sockaddr_in *)EXT(statp).nsaddrs[ns];
- if ((srv != NULL) && (srv->sin_family == AF_INET) &&
- (srv->sin_port == port) &&
- (srv->sin_addr.s_addr == INADDR_ANY ||
- srv->sin_addr.s_addr == addr))
- return (1);
- }
- } else if (inp->sin6_family == AF_INET6) {
- for (ns = 0; ns < MAXNS; ns++) {
- const struct sockaddr_in6 *srv = EXT(statp).nsaddrs[ns];
- if ((srv != NULL) && (srv->sin6_family == AF_INET6) &&
- (srv->sin6_port == inp->sin6_port) &&
- !(memcmp(&srv->sin6_addr, &in6addr_any,
- sizeof (struct in6_addr)) &&
- memcmp(&srv->sin6_addr, &inp->sin6_addr,
- sizeof (struct in6_addr))))
- return (1);
- }
- }
+ if ((srv != NULL) && (srv->sin_family == AF_INET) &&
+ (srv->sin_port == port) &&
+ (srv->sin_addr.s_addr == INADDR_ANY ||
+ srv->sin_addr.s_addr == addr))
+ return (1);
+ }
+ } else if (inp->sin6_family == AF_INET6) {
+ for (ns = 0; ns < MAXNS; ns++) {
+ const struct sockaddr_in6 *srv = EXT(statp).nsaddrs[ns];
+ if ((srv != NULL) && (srv->sin6_family == AF_INET6) &&
+ (srv->sin6_port == inp->sin6_port) &&
+ !(memcmp(&srv->sin6_addr, &in6addr_any,
+ sizeof (struct in6_addr)) &&
+ memcmp(&srv->sin6_addr, &inp->sin6_addr,
+ sizeof (struct in6_addr))))
+ return (1);
+ }
+ }
return (0);
}
@@ -445,7 +445,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
malloc(sizeof (struct sockaddr_in6));
if (EXT(statp).nsaddrs[n] != NULL) {
memset (mempcpy(EXT(statp).nsaddrs[n],
- &statp->nsaddr_list[ns],
+ &statp->nsaddr_list[n],
sizeof (struct sockaddr_in)),
'\0',
sizeof (struct sockaddr_in6)
@@ -1003,7 +1003,7 @@ send_dg(res_state statp,
int orig_anssizp = *anssizp;
struct timespec now, timeout, finish;
struct pollfd pfd[1];
- int ptimeout;
+ int ptimeout;
struct sockaddr_in6 from;
int resplen, n;
@@ -1050,7 +1050,7 @@ send_dg(res_state statp,
evSubTime(&timeout, &finish, &now);
need_recompute = 0;
}
- /* Convert struct timespec in milliseconds. */
+ /* Convert struct timespec in milliseconds. */
ptimeout = timeout.tv_sec * 1000 + timeout.tv_nsec / 1000000;
n = 0;
@@ -1244,7 +1244,7 @@ send_dg(res_state statp,
/* record the error */
statp->_flags |= RES_F_EDNS0ERR;
goto err_out;
- }
+ }
#endif
if (!(statp->options & RES_INSECURE2)
&& (recvresp1 || !res_queriesmatch(buf, buf + buflen,