mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-09 10:50:08 +00:00
Fix mixing IPv4 and IPv6 name server in resolv.conf.
This commit is contained in:
parent
3ad3a4d059
commit
3a85895fa3
@ -1,3 +1,8 @@
|
|||||||
|
2009-10-29 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* resolv/res_send.c (__libc_res_nsend): Fix copying of IPv4 server
|
||||||
|
addresses. Patch by Petar Bogdanovic <petar@smokva.net>.
|
||||||
|
|
||||||
2009-10-24 Joseph Myers <joseph@codesourcery.com>
|
2009-10-24 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
* sysdeps/ieee754/ldbl-128/w_expl.c: Add hidden_def (__expl).
|
* sysdeps/ieee754/ldbl-128/w_expl.c: Add hidden_def (__expl).
|
||||||
|
@ -219,33 +219,33 @@ res_ourserver_p(const res_state statp, const struct sockaddr_in6 *inp)
|
|||||||
{
|
{
|
||||||
int ns;
|
int ns;
|
||||||
|
|
||||||
if (inp->sin6_family == AF_INET) {
|
if (inp->sin6_family == AF_INET) {
|
||||||
struct sockaddr_in *in4p = (struct sockaddr_in *) inp;
|
struct sockaddr_in *in4p = (struct sockaddr_in *) inp;
|
||||||
in_port_t port = in4p->sin_port;
|
in_port_t port = in4p->sin_port;
|
||||||
in_addr_t addr = in4p->sin_addr.s_addr;
|
in_addr_t addr = in4p->sin_addr.s_addr;
|
||||||
|
|
||||||
for (ns = 0; ns < MAXNS; ns++) {
|
for (ns = 0; ns < MAXNS; ns++) {
|
||||||
const struct sockaddr_in *srv =
|
const struct sockaddr_in *srv =
|
||||||
(struct sockaddr_in *)EXT(statp).nsaddrs[ns];
|
(struct sockaddr_in *)EXT(statp).nsaddrs[ns];
|
||||||
|
|
||||||
if ((srv != NULL) && (srv->sin_family == AF_INET) &&
|
if ((srv != NULL) && (srv->sin_family == AF_INET) &&
|
||||||
(srv->sin_port == port) &&
|
(srv->sin_port == port) &&
|
||||||
(srv->sin_addr.s_addr == INADDR_ANY ||
|
(srv->sin_addr.s_addr == INADDR_ANY ||
|
||||||
srv->sin_addr.s_addr == addr))
|
srv->sin_addr.s_addr == addr))
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
} else if (inp->sin6_family == AF_INET6) {
|
} else if (inp->sin6_family == AF_INET6) {
|
||||||
for (ns = 0; ns < MAXNS; ns++) {
|
for (ns = 0; ns < MAXNS; ns++) {
|
||||||
const struct sockaddr_in6 *srv = EXT(statp).nsaddrs[ns];
|
const struct sockaddr_in6 *srv = EXT(statp).nsaddrs[ns];
|
||||||
if ((srv != NULL) && (srv->sin6_family == AF_INET6) &&
|
if ((srv != NULL) && (srv->sin6_family == AF_INET6) &&
|
||||||
(srv->sin6_port == inp->sin6_port) &&
|
(srv->sin6_port == inp->sin6_port) &&
|
||||||
!(memcmp(&srv->sin6_addr, &in6addr_any,
|
!(memcmp(&srv->sin6_addr, &in6addr_any,
|
||||||
sizeof (struct in6_addr)) &&
|
sizeof (struct in6_addr)) &&
|
||||||
memcmp(&srv->sin6_addr, &inp->sin6_addr,
|
memcmp(&srv->sin6_addr, &inp->sin6_addr,
|
||||||
sizeof (struct in6_addr))))
|
sizeof (struct in6_addr))))
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,7 +445,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
|
|||||||
malloc(sizeof (struct sockaddr_in6));
|
malloc(sizeof (struct sockaddr_in6));
|
||||||
if (EXT(statp).nsaddrs[n] != NULL) {
|
if (EXT(statp).nsaddrs[n] != NULL) {
|
||||||
memset (mempcpy(EXT(statp).nsaddrs[n],
|
memset (mempcpy(EXT(statp).nsaddrs[n],
|
||||||
&statp->nsaddr_list[ns],
|
&statp->nsaddr_list[n],
|
||||||
sizeof (struct sockaddr_in)),
|
sizeof (struct sockaddr_in)),
|
||||||
'\0',
|
'\0',
|
||||||
sizeof (struct sockaddr_in6)
|
sizeof (struct sockaddr_in6)
|
||||||
@ -1003,7 +1003,7 @@ send_dg(res_state statp,
|
|||||||
int orig_anssizp = *anssizp;
|
int orig_anssizp = *anssizp;
|
||||||
struct timespec now, timeout, finish;
|
struct timespec now, timeout, finish;
|
||||||
struct pollfd pfd[1];
|
struct pollfd pfd[1];
|
||||||
int ptimeout;
|
int ptimeout;
|
||||||
struct sockaddr_in6 from;
|
struct sockaddr_in6 from;
|
||||||
int resplen, n;
|
int resplen, n;
|
||||||
|
|
||||||
@ -1050,7 +1050,7 @@ send_dg(res_state statp,
|
|||||||
evSubTime(&timeout, &finish, &now);
|
evSubTime(&timeout, &finish, &now);
|
||||||
need_recompute = 0;
|
need_recompute = 0;
|
||||||
}
|
}
|
||||||
/* Convert struct timespec in milliseconds. */
|
/* Convert struct timespec in milliseconds. */
|
||||||
ptimeout = timeout.tv_sec * 1000 + timeout.tv_nsec / 1000000;
|
ptimeout = timeout.tv_sec * 1000 + timeout.tv_nsec / 1000000;
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
@ -1244,7 +1244,7 @@ send_dg(res_state statp,
|
|||||||
/* record the error */
|
/* record the error */
|
||||||
statp->_flags |= RES_F_EDNS0ERR;
|
statp->_flags |= RES_F_EDNS0ERR;
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!(statp->options & RES_INSECURE2)
|
if (!(statp->options & RES_INSECURE2)
|
||||||
&& (recvresp1 || !res_queriesmatch(buf, buf + buflen,
|
&& (recvresp1 || !res_queriesmatch(buf, buf + buflen,
|
||||||
|
Loading…
Reference in New Issue
Block a user