AC_MSG_NOTICE([Support for Ident lookups enabled: ${enable_ident_lookups:=yes}])
SQUID_DEFINE_BOOL(USE_IDENT,$enable_ident_lookups,[Support for Ident (RFC 931) lookups])
-squid_opt_use_dnsserver="no"
+squid_opt_use_dnshelper="no"
AC_ARG_ENABLE(internal-dns,
AS_HELP_STRING([--disable-internal-dns],
[Prevents Squid from directly sending and receiving DNS messages,
and instead enables the old external 'dnsserver' processes.]), [
if test "x$enableval" = "xno" ; then
AC_MSG_WARN([Disabling Internal DNS queries])
- squid_opt_use_dnsserver="yes"
+ squid_opt_use_dnshelper="yes"
fi
])
-SQUID_DEFINE_BOOL(USE_DNSSERVERS,$squid_opt_use_dnsserver,
+SQUID_DEFINE_BOOL(USE_DNSHELPER,$squid_opt_use_dnshelper,
[Use dnsserver processes instead of the internal DNS protocol support])
-AM_CONDITIONAL([USE_DNSSERVER],[test "x$squid_opt_use_dnsserver" = "xyes" ])
+AM_CONDITIONAL([ENABLE_DNSHELPER],[test "x$squid_opt_use_dnshelper" = "xyes" ])
AM_CONDITIONAL(USE_SSL_CRTD, false)
SQUID_CHECK_NEED_SYS_ERRLIST
SQUID_CHECK_MAXPATHLEN
-if test "x$squid_opt_use_dnsserver" = "xyes"; then
+if test "x$squid_opt_use_dnshelper" = "xyes"; then
SQUID_CHECK_LIBRESOLV_DNS_TTL_HACK
SQUID_CHECK_RESOLVER_FIELDS
fi
USE_CLASSFUL \
USE_DELAY_POOLS \
USE_DLMALLOC \
- USE_DNSSERVERS \
+ USE_DNSHELPER \
USE_EPOLL \
USE_GNUREGEX \
USE_HEXDUMP \
include $(top_srcdir)/src/Common.am
AUTOMAKE_OPTIONS = subdir-objects
-if USE_DNSSERVER
+
+if ENABLE_DNSHELPER
DNSSOURCE = dns.cc
-DNSSERVER = dnsserver
+DNSHELPER = dnsserver
else
DNSSOURCE = dns_internal.cc
-DNSSERVER =
+DNSHELPER =
endif
DNSSOURCE += \
+ SquidDns.h \
DnsLookupDetails.h \
DnsLookupDetails.cc
libexec_PROGRAMS = \
- $(DNSSERVER) \
+ $(DNSHELPER) \
$(DISK_PROGRAMS) \
$(UNLINKD)
## dnsserver is a standalone helper. Do not link to any internal libraries
dnsserver_SOURCES = dnsserver.cc
-## SquidNew.cc tests/stub_debug.cc test_tools.cc time.cc
dnsserver_LDADD = $(COMPAT_LIB)
recv_announce_SOURCES = recv-announce.cc
--- /dev/null
+#ifndef SQUID_DNS_H
+#define SQUID_DNS_H
+
+namespace Ip {
+class Address;
+}
+
+// generic DNS API
+extern void dnsInit(void);
+extern void dnsShutdown(void);
+
+#if USE_DNSHELPER
+// external DNS helper API
+extern void dnsSubmit(const char *lookup, HLPCB * callback, void *data);
+#else
+// internal DNS client API
+extern void idnsALookup(const char *, IDNSCB *, void *);
+extern void idnsPTRLookup(const Ip::Address &, IDNSCB *, void *);
+#endif
+
+#endif /* SQUID_DNS_H */
#if USE_SSL
static void parseBytesOptionValue(size_t * bptr, const char *units, char const * value);
#endif
-#if !USE_DNSSERVERS
+#if !USE_DNSHELPER
static void parseBytesLineSigned(ssize_t * bptr, const char *units);
#endif
static size_t parseBytesUnits(const char *unit);
else
visible_appname_string = (char const *)APP_FULLNAME;
-#if USE_DNSSERVERS
-
+#if USE_DNSHELPER
if (Config.dnsChildren.n_max < 1)
- fatal("No dnsservers allocated");
-
+ fatal("No DNS helpers allocated");
#endif
if (Config.Program.redirect) {
}
requirePathnameExists("MIME Config Table", Config.mimeTablePathname);
-#if USE_DNSSERVERS
-
+#if USE_DNSHELPER
requirePathnameExists("cache_dns_program", Config.Program.dnsserver);
#endif
#if USE_UNLINKD
self_destruct();
}
-#if !USE_DNSSERVERS
+#if !USE_DNSHELPER
static void
parseBytesLineSigned(ssize_t * bptr, const char *units)
{
*var = 0;
}
-#if !USE_DNSSERVERS
+#if !USE_DNSHELPER
static void
dump_time_msec(StoreEntry * entry, const char *name, time_msec_t var)
{
storeAppendPrintf(entry, "%s %d %s\n", name, (int) var, B_BYTES_STR);
}
-#if !USE_DNSSERVERS
+#if !USE_DNSHELPER
static void
dump_b_ssize_t(StoreEntry * entry, const char *name, ssize_t var)
{
parseBytesLine(var, B_BYTES_STR);
}
-#if !USE_DNSSERVERS
+#if !USE_DNSHELPER
static void
parse_b_ssize_t(ssize_t * var)
{
*var = 0;
}
-#if !USE_DNSSERVERS
+#if !USE_DNSHELPER
static void
free_ssize_t(ssize_t * var)
{
NAME: cache_dns_program
TYPE: string
-IFDEF: USE_DNSSERVERS
+IFDEF: USE_DNSHELPER
DEFAULT: @DEFAULT_DNSSERVER@
LOC: Config.Program.dnsserver
DOC_START
NAME: dns_children
TYPE: HelperChildConfig
-IFDEF: USE_DNSSERVERS
+IFDEF: USE_DNSHELPER
DEFAULT: 32 startup=1 idle=1
LOC: Config.dnsChildren
DOC_START
TYPE: time_msec
DEFAULT: 5 seconds
LOC: Config.Timeout.idns_retransmit
-IFDEF: !USE_DNSSERVERS
+IFDEF: !USE_DNSHELPER
DOC_START
Initial retransmit interval for DNS queries. The interval is
doubled each time all configured DNS servers have been tried.
TYPE: time_msec
DEFAULT: 30 seconds
LOC: Config.Timeout.idns_query
-IFDEF: !USE_DNSSERVERS
+IFDEF: !USE_DNSHELPER
DOC_START
DNS Query timeout. If no response is received to a DNS query
within this time all DNS servers for the queried domain
TYPE: b_ssize_t
DEFAULT: none
LOC: Config.dns.packet_max
-IFDEF: !USE_DNSSERVERS
+IFDEF: !USE_DNSHELPER
DOC_START
Maximum number of bytes packet size to advertise via EDNS.
Set to "none" to disable EDNS large packet support.
TYPE: onoff
LOC: Config.onoff.ignore_unknown_nameservers
DEFAULT: on
-IFDEF: !USE_DNSSERVERS
+IFDEF: !USE_DNSHELPER
DOC_START
By default Squid checks that DNS responses are received
from the same IP addresses they are sent to. If they
TYPE: onoff
DEFAULT: on
LOC: Config.onoff.dns_require_A
-IFDEF: !USE_DNSSERVERS
+IFDEF: !USE_DNSHELPER
DOC_START
Standard practice with DNS is to lookup either A or AAAA records
and use the results if it succeeds. Only looking up the other if
TYPE: onoff
DEFAULT: off
LOC: Config.dns.v4_first
-IFDEF: !USE_DNSSERVERS
+IFDEF: !USE_DNSHELPER
DOC_START
With the IPv6 Internet being as fast or faster than IPv4 Internet
for most networks Squid prefers to contact websites over IPv6.
define["SQUID_SNMP"]="--enable-snmp"
define["USE_ADAPTATION"]="--enable-ecap or --enable-icap-client"
define["USE_CACHE_DIGESTS"]="--enable-cache-digests"
- define["USE_DNSSERVERS"]="--disable-internal-dns"
- define["!USE_DNSSERVERS"]="--enable-internal-dns"
+ define["USE_DNSHELPER"]="--disable-internal-dns"
+ define["!USE_DNSHELPER"]="--enable-internal-dns"
define["USE_ECAP"]="--enable-ecap"
define["USE_ERR_LOCALES"]="--enable-auto-locale"
define["USE_HTCP"]="--enable-htcp"
*/
if (r->flags.nocache) {
-#if USE_DNSSERVERS
-
+#if USE_DNSHELPER
ipcacheInvalidate(r->GetHost());
-
#else
-
ipcacheInvalidateNegative(r->GetHost());
-
-#endif /* USE_DNSSERVERS */
+#endif /* USE_DNSHELPER */
}
else if (r->flags.nocache_hack) {
-#if USE_DNSSERVERS
-
+#if USE_DNSHELPER
ipcacheInvalidate(r->GetHost());
-
#else
-
ipcacheInvalidateNegative(r->GetHost());
-
-#endif /* USE_DNSSERVERS */
+#endif /* USE_DNSHELPER */
}
#if to include the external DNS code in compile process when
using external DNS.
*/
-#if USE_DNSSERVERS
+#if USE_DNSHELPER
static helper *dnsservers = NULL;
}
#endif /* SQUID_SNMP */
-#endif /* USE_DNSSERVERS */
+#endif /* USE_DNSHELPER */
#ifndef to exclude the internal DNS code from compile process when
using external DNS process.
*/
-#if !USE_DNSSERVERS
+#if !USE_DNSHELPER
#if _SQUID_WINDOWS_
#include "squid_windows.h"
#define REG_TCPIP_PARA_INTERFACES "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces"
delete vc->queue;
delete vc->msg;
vc->conn = NULL;
- if (vc->ns < nns) // XXX: idnsShutdown may have freed nameservers[]
+ if (vc->ns < nns) // XXX: dnsShutdown may have freed nameservers[]
nameservers[vc->ns].vc = NULL;
cbdataFree(vc);
}
}
void
-idnsInit(void)
+dnsInit(void)
{
static int init = 0;
}
void
-idnsShutdown(void)
+dnsShutdown(void)
{
if (DnsSocketA < 0 && DnsSocketB < 0)
return;
* The function to return the DNS via SNMP
*/
variable_list *
-snmp_netIdnsFn(variable_list * Var, snint * ErrP)
+snmp_netDnsFn(variable_list * Var, snint * ErrP)
{
int i, n = 0;
variable_list *Answer = NULL;
}
#endif /*SQUID_SNMP */
-#endif /* USE_DNSSERVERS */
+#endif /* USE_DNSHELPER */
// following pools are initialized late by their component if needed (or never)
MEM_FQDNCACHE_ENTRY,
MEM_FWD_SERVER,
-#if !USE_DNSSERVERS
+#if !USE_DNSHELPER
MEM_IDNS_QUERY,
#endif
MEM_IPCACHE_ENTRY,
#include "DnsLookupDetails.h"
#include "event.h"
#include "mgr/Registration.h"
+#include "SquidDns.h"
#include "SquidTime.h"
#include "StatCounters.h"
#include "Store.h"
/// \ingroup FQDNCacheInternal
static dlink_list lru_list;
-#if USE_DNSSERVERS
+#if USE_DNSHELPER
static HLPCB fqdncacheHandleReply;
static int fqdncacheParse(fqdncache_entry *, const char *buf);
#else
}
/// \ingroup FQDNCacheInternal
-#if USE_DNSSERVERS
+#if USE_DNSHELPER
static int
fqdncacheParse(fqdncache_entry *f, const char *inbuf)
{
* Callback for handling DNS results.
*/
static void
-#if USE_DNSSERVERS
+#if USE_DNSHELPER
fqdncacheHandleReply(void *data, char *reply)
#else
fqdncacheHandleReply(void *data, rfc1035_rr * answers, int na, const char *error_message)
++FqdncacheStats.replies;
const int age = f->age();
statCounter.dns.svcTime.count(age);
-#if USE_DNSSERVERS
+#if USE_DNSHELPER
fqdncacheParse(f, reply);
#else
f->handlerData = cbdataReference(handlerData);
f->request_time = current_time;
c = new generic_cbdata(f);
-#if USE_DNSSERVERS
-
+#if USE_DNSHELPER
dnsSubmit(hashKeyStr(&f->hash), fqdncacheHandleReply, c);
#else
idnsPTRLookup(addr, fqdncacheHandleReply, c);
#include "ip/tools.h"
#include "ipcache.h"
#include "mgr/Registration.h"
+#include "SquidDns.h"
#include "SquidTime.h"
#include "StatCounters.h"
#include "Store.h"
static void stat_ipcache_get(StoreEntry *);
static FREE ipcacheFreeEntry;
-#if USE_DNSSERVERS
+#if USE_DNSHELPER
static HLPCB ipcacheHandleReply;
#else
static IDNSCB ipcacheHandleReply;
#endif
static int ipcacheExpiredEntry(ipcache_entry *);
-#if USE_DNSSERVERS
+#if USE_DNSHELPER
static int ipcacheParse(ipcache_entry *, const char *buf);
#else
static int ipcacheParse(ipcache_entry *, rfc1035_rr *, int, const char *error);
}
/// \ingroup IPCacheAPI
-#if USE_DNSSERVERS
+#if USE_DNSHELPER
static int
ipcacheParse(ipcache_entry *i, const char *inbuf)
{
/// \ingroup IPCacheInternal
static void
-#if USE_DNSSERVERS
+#if USE_DNSHELPER
ipcacheHandleReply(void *data, char *reply)
#else
ipcacheHandleReply(void *data, rfc1035_rr * answers, int na, const char *error_message)
const int age = i->age();
statCounter.dns.svcTime.count(age);
-#if USE_DNSSERVERS
+#if USE_DNSHELPER
ipcacheParse(i, reply);
#else
i->handlerData = cbdataReference(handlerData);
i->request_time = current_time;
c = new generic_cbdata(i);
-#if USE_DNSSERVERS
-
+#if USE_DNSHELPER
dnsSubmit(hashKeyStr(&i->hash), ipcacheHandleReply, c);
#else
-
idnsALookup(hashKeyStr(&i->hash), ipcacheHandleReply, c);
#endif
}
#include "format/Token.h"
#include "fs/Module.h"
#include "PeerSelectState.h"
+#include "SquidDns.h"
#include "Store.h"
#include "ICP.h"
#include "ident/Ident.h"
htcpSocketClose();
#endif
-#if USE_DNSSERVERS
-
dnsShutdown();
-#else
-
- idnsShutdown();
-#endif
#if USE_SSL_CRTD
Ssl::Helper::GetInstance()->Shutdown();
#endif
icapLogOpen();
#endif
storeLogOpen();
-#if USE_DNSSERVERS
-
dnsInit();
-#else
-
- idnsInit();
-#endif
#if USE_SSL_CRTD
Ssl::Helper::GetInstance()->Init();
#endif
mainRotate(void)
{
icmpEngine.Close();
-#if USE_DNSSERVERS
+#if USE_DNSHELPER
dnsShutdown();
#endif
redirectShutdown();
icapLogRotate(); /*icap.log*/
#endif
icmpEngine.Open();
-#if USE_DNSSERVERS
+#if USE_DNSHELPER
dnsInit();
#endif
redirectInit();
parseEtcHosts();
-#if USE_DNSSERVERS
-
dnsInit();
-#else
-
- idnsInit();
-
-#endif
-
#if USE_SSL_CRTD
Ssl::Helper::GetInstance()->Init();
#endif
#endif
debugs(1, 1, "Shutting down...");
-#if USE_DNSSERVERS
-
dnsShutdown();
-#else
-
- idnsShutdown();
-#endif
#if USE_SSL_CRTD
Ssl::Helper::GetInstance()->Shutdown();
#endif
SQUIDCEXTERN void file_read(int, char *, int, off_t, DRCB *, void *);
SQUIDCEXTERN void disk_init(void);
-SQUIDCEXTERN void dnsShutdown(void);
-SQUIDCEXTERN void dnsInit(void);
-SQUIDCEXTERN void dnsSubmit(const char *lookup, HLPCB * callback, void *data);
-
-/* dns_internal.c */
-SQUIDCEXTERN void idnsInit(void);
-SQUIDCEXTERN void idnsShutdown(void);
-SQUIDCEXTERN void idnsALookup(const char *, IDNSCB *, void *);
-
-SQUIDCEXTERN void idnsPTRLookup(const Ip::Address &, IDNSCB *, void *);
-
SQUIDCEXTERN void fd_close(int fd);
SQUIDCEXTERN void fd_open(int fd, unsigned int type, const char *);
SQUIDCEXTERN void fd_note(int fd, const char *);
extern variable_list *snmp_prfPeerFn(variable_list *, snint *);
extern variable_list *snmp_netIpFn(variable_list *, snint *);
extern variable_list *snmp_netFqdnFn(variable_list *, snint *);
-#if USE_DNSSERVERS
extern variable_list *snmp_netDnsFn(variable_list *, snint *);
-#else
-extern variable_list *snmp_netIdnsFn(variable_list *, snint *);
-#endif /* USE_DNSSERVERS */
extern variable_list *snmp_meshPtblFn(variable_list *, snint *);
extern variable_list *snmp_meshCtblFn(variable_list *, snint *);
#endif /* SQUID_SNMP */
snmpAddNodeStr("1.3.6.1.4.1.3495.1.4.2", FQDN_GHBN, snmp_netFqdnFn, static_Inst, atSum);
snmpAddNodeStr("1.3.6.1.4.1.3495.1.4", NET_DNS_CACHE, NULL, NULL);
-#if USE_DNSSERVERS
snmpAddNodeStr("1.3.6.1.4.1.3495.1.4.3", DNS_REQ, snmp_netDnsFn, static_Inst, atSum);
snmpAddNodeStr("1.3.6.1.4.1.3495.1.4.3", DNS_REP, snmp_netDnsFn, static_Inst, atSum);
snmpAddNodeStr("1.3.6.1.4.1.3495.1.4.3", DNS_SERVERS, snmp_netDnsFn, static_Inst, atSum);
-#else
- snmpAddNodeStr("1.3.6.1.4.1.3495.1.4.3", DNS_REQ, snmp_netIdnsFn, static_Inst, atSum);
- snmpAddNodeStr("1.3.6.1.4.1.3495.1.4.3", DNS_REP, snmp_netIdnsFn, static_Inst, atSum);
- snmpAddNodeStr("1.3.6.1.4.1.3495.1.4.3", DNS_SERVERS, snmp_netIdnsFn, static_Inst, atSum);
-#endif
/* SQ_MESH - 1.3.6.1.4.1.3495.1.5 */
snmpAddNodeStr("1.3.6.1.4.1.3495.1", 5, NULL, NULL);
int icp_query_min; /* msec */
int mcast_icp_query; /* msec */
-#if !USE_DNSSERVERS
-
+#if !USE_DNSHELPER
time_msec_t idns_retransmit;
time_msec_t idns_query;
#endif
char *effectiveGroup;
struct {
-#if USE_DNSSERVERS
+#if USE_DNSHELPER
char *dnsserver;
#endif
#endif
} Program;
-#if USE_DNSSERVERS
-
+#if USE_DNSHELPER
HelperChildConfig dnsChildren;
#endif