#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
-static char rcsid[] = "$Id: res_send.c,v 1.2.202.1 2002/11/06 17:30:17 majka Exp $";
+static char rcsid[] = "$Id: res_send.c,v 1.6 2003/02/18 17:29:25 majka Exp $";
#endif /* LIBC_SCCS and not lint */
/* change this to "0"
#include <sys/socket.h>
#include <sys/uio.h>
#include <netinet/in.h>
-#include <arpa/nameser.h>
+#include <arpa/nameser8_compat.h>
#include <arpa/inet.h>
#include <ifaddrs.h>
#include <net/if.h>
#include <stdio.h>
#include <netdb.h>
#include <errno.h>
-#include <resolv.h>
+#include <resolv8_compat.h>
#if defined(BSD) && (BSD >= 199306)
# include <stdlib.h>
# include <string.h>
}
#endif
-extern struct __res_state _res_shadow;
-
static res_send_qhook Qhook = NULL;
static res_send_rhook Rhook = NULL;
return (1);
}
-static int res_using_defaults()
-{
- int i;
-
- if (_res.nscount != _res_shadow.nscount)
- return 0;
-
- for (i = 0; i < _res.nscount; i++) {
- /* Check that the address and port have not changed */
- if ((_res.nsaddr_list[i].sin_addr.s_addr !=
- _res_shadow.nsaddr_list[i].sin_addr.s_addr) ||
- (_res.nsaddr_list[i].sin_port !=
- _res_shadow.nsaddr_list[i].sin_port)) {
- return 0;
- }
- }
-
- return 1;
-}
-
/* Returns whether a dns encoded name should be sent to multicast or not */
static int dns_is_local_name(const u_int8_t *name)
{
const u_int8_t *d1 = NULL; // Second-Level Domain
const u_int8_t *d2 = NULL; // etc.
const u_int8_t *d3 = NULL;
-
+
+ if (name == NULL) return 0;
+
while (*name)
{
d3 = d2;
terrno = ETIMEDOUT;
badns = 0;
- if (res_using_defaults() &&
- dns_is_local_name((u_int8_t*)(buf + DNS_HEADER_SIZE))) {
+ if (dns_is_local_name((u_int8_t*)(buf + DNS_HEADER_SIZE))) {
multicast = 1;
v_circuit = 0;
} else {
struct timeval timeout;
fd_set dsmask;
struct sockaddr_in from;
- int fromlen;
+ unsigned int fromlen;
if ((s < 0) || vc) {
if (vc)