*/
/** @file
* @brief IRC resolver functions.
- * @version $Id: ircd_res.c,v 1.23 2005/06/27 13:25:51 entrope Exp $
+ * @version $Id: ircd_res.c,v 1.23.2.4 2006/03/14 03:45:52 entrope Exp $
*/
#include "client.h"
if (!s_active(&res_socket_v4))
{
- int fd = os_socket(&VirtualHost_v4, SOCK_DGRAM, "Resolver UDPv4 socket");
+ int fd = os_socket(&VirtualHost_v4, SOCK_DGRAM, "Resolver UDPv4 socket", AF_INET);
if (fd >= 0)
socket_add(&res_socket_v4, res_readreply, NULL,
SS_DATAGRAM, SOCK_EVENT_READABLE, fd);
}
+#ifdef AF_INET6
if (!s_active(&res_socket_v6))
{
- int fd = os_socket(&VirtualHost_v6, SOCK_DGRAM, "Resolver UDPv6 socket");
+ int fd = os_socket(&VirtualHost_v6, SOCK_DGRAM, "Resolver UDPv6 socket", AF_INET6);
if (fd >= 0)
socket_add(&res_socket_v6, res_readreply, NULL,
SS_DATAGRAM, SOCK_EVENT_READABLE, fd);
}
+#endif
if (s_active(&res_socket_v4) || s_active(&res_socket_v6))
timer_init(&res_timeout);
break;
case T_CNAME: /* first check we already haven't started looking
into a cname */
- if (request->type != T_PTR)
- return(0);
-
if (request->state == REQ_CNAME)
{
n = irc_dn_expand((unsigned char *)buf, (unsigned char *)eob,
if ((header->rcode != NO_ERRORS) || (header->ancount == 0))
{
- if (SERVFAIL == header->rcode)
- resend_query(request);
+ if (SERVFAIL == header->rcode || NXDOMAIN == header->rcode)
+ {
+ /*
+ * If a bad error was returned, we stop here and don't send
+ * send any more (no retries granted).
+ */
+ Debug((DEBUG_DNS, "Request %p has bad response (state %d type %d rcode %d)", request, request->state, request->type, header->rcode));
+ (*request->callback)(request->callback_ctx, NULL, NULL);
+ rem_request(request);
+ }
else
{
/*
request->timeout += feature_int(FEAT_IRCD_RES_TIMEOUT);
resend_query(request);
}
- else
- {
- /*
- * If a bad error was returned, we stop here and don't send
- * send any more (no retries granted).
- */
- Debug((DEBUG_DNS, "Request %p has bad response (state %d type %d rcode %d)", request, request->state, request->type, header->rcode));
- (*request->callback)(request->callback_ctx, NULL, NULL);
- rem_request(request);
- }
}
return;