mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Make authoritative stuff a compile-time option.
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include "dnsmasq.h"
|
#include "dnsmasq.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_AUTH
|
||||||
|
|
||||||
static struct subnet *filter_zone(struct auth_zone *zone, int flag, struct all_addr *addr_u)
|
static struct subnet *filter_zone(struct auth_zone *zone, int flag, struct all_addr *addr_u)
|
||||||
{
|
{
|
||||||
@@ -735,7 +736,7 @@ size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t n
|
|||||||
return ansp - (unsigned char *)header;
|
return ansp - (unsigned char *)header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
16
src/config.h
16
src/config.h
@@ -96,12 +96,18 @@ HAVE_CONNTRACK
|
|||||||
a build-dependency on libnetfilter_conntrack, but the resulting binary will
|
a build-dependency on libnetfilter_conntrack, but the resulting binary will
|
||||||
still run happily on a kernel without conntrack support.
|
still run happily on a kernel without conntrack support.
|
||||||
|
|
||||||
|
HAVE_AUTH
|
||||||
|
define this to include the facility to act as an authoritative DNS
|
||||||
|
server for one or more zones.
|
||||||
|
|
||||||
|
|
||||||
NO_IPV6
|
NO_IPV6
|
||||||
NO_TFTP
|
NO_TFTP
|
||||||
NO_DHCP
|
NO_DHCP
|
||||||
NO_DHCP6
|
NO_DHCP6
|
||||||
NO_SCRIPT
|
NO_SCRIPT
|
||||||
NO_LARGEFILE
|
NO_LARGEFILE
|
||||||
|
NO_AUTH
|
||||||
these are avilable to explictly disable compile time options which would
|
these are avilable to explictly disable compile time options which would
|
||||||
otherwise be enabled automatically (HAVE_IPV6, >2Gb file sizes) or
|
otherwise be enabled automatically (HAVE_IPV6, >2Gb file sizes) or
|
||||||
which are enabled by default in the distributed source tree. Building dnsmasq
|
which are enabled by default in the distributed source tree. Building dnsmasq
|
||||||
@@ -123,6 +129,7 @@ RESOLVFILE
|
|||||||
#define HAVE_DHCP6
|
#define HAVE_DHCP6
|
||||||
#define HAVE_TFTP
|
#define HAVE_TFTP
|
||||||
#define HAVE_SCRIPT
|
#define HAVE_SCRIPT
|
||||||
|
#define HAVE_AUTH
|
||||||
/* #define HAVE_LUASCRIPT */
|
/* #define HAVE_LUASCRIPT */
|
||||||
/* #define HAVE_BROKEN_RTC */
|
/* #define HAVE_BROKEN_RTC */
|
||||||
/* #define HAVE_DBUS */
|
/* #define HAVE_DBUS */
|
||||||
@@ -311,6 +318,9 @@ HAVE_SOCKADDR_SA_LEN
|
|||||||
#define HAVE_SCRIPT
|
#define HAVE_SCRIPT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NO_AUTH
|
||||||
|
#undef HAVE_AUTH
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Define a string indicating which options are in use.
|
/* Define a string indicating which options are in use.
|
||||||
DNSMASQP_COMPILE_OPTS is only defined in dnsmasq.c */
|
DNSMASQP_COMPILE_OPTS is only defined in dnsmasq.c */
|
||||||
@@ -369,7 +379,11 @@ static char *compile_opts =
|
|||||||
#ifndef HAVE_CONNTRACK
|
#ifndef HAVE_CONNTRACK
|
||||||
"no-"
|
"no-"
|
||||||
#endif
|
#endif
|
||||||
"conntrack";
|
"conntrack "
|
||||||
|
#ifndef HAVE_AUTH
|
||||||
|
"no-"
|
||||||
|
#endif
|
||||||
|
"auth";
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -148,6 +148,11 @@ int main (int argc, char **argv)
|
|||||||
die(_("asychronous logging is not available under Android"), NULL, EC_BADCONF);
|
die(_("asychronous logging is not available under Android"), NULL, EC_BADCONF);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_AUTH
|
||||||
|
if (daemon->authserver)
|
||||||
|
die(_("authoritative DNS not available: set HAVE_AUTH in src/config.h"), NULL, EC_BADCONF);
|
||||||
|
#endif
|
||||||
|
|
||||||
rand_init();
|
rand_init();
|
||||||
|
|
||||||
now = dnsmasq_time();
|
now = dnsmasq_time();
|
||||||
|
|||||||
@@ -910,7 +910,9 @@ int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
|
|||||||
int in_arpa_name_2_addr(char *namein, struct all_addr *addrp);
|
int in_arpa_name_2_addr(char *namein, struct all_addr *addrp);
|
||||||
|
|
||||||
/* auth.c */
|
/* auth.c */
|
||||||
|
#ifdef HAVE_AUTH
|
||||||
size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t now, union mysockaddr *peer_addr);
|
size_t answer_auth(struct dns_header *header, char *limit, size_t qlen, time_t now, union mysockaddr *peer_addr);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* util.c */
|
/* util.c */
|
||||||
void rand_init(void);
|
void rand_init(void);
|
||||||
|
|||||||
@@ -812,6 +812,7 @@ void receive_query(struct listener *listen, time_t now)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_AUTH
|
||||||
if (auth_dns)
|
if (auth_dns)
|
||||||
{
|
{
|
||||||
m = answer_auth(header, ((char *) header) + PACKETSZ, (size_t)n, now, &source_addr);
|
m = answer_auth(header, ((char *) header) + PACKETSZ, (size_t)n, now, &source_addr);
|
||||||
@@ -820,6 +821,7 @@ void receive_query(struct listener *listen, time_t now)
|
|||||||
(char *)header, m, &source_addr, &dst_addr, if_index);
|
(char *)header, m, &source_addr, &dst_addr, if_index);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
m = answer_request(header, ((char *) header) + PACKETSZ, (size_t)n,
|
m = answer_request(header, ((char *) header) + PACKETSZ, (size_t)n,
|
||||||
dst_addr_4, netmask, now);
|
dst_addr_4, netmask, now);
|
||||||
@@ -903,9 +905,11 @@ unsigned char *tcp_request(int confd, time_t now,
|
|||||||
else
|
else
|
||||||
dst_addr_4.s_addr = 0;
|
dst_addr_4.s_addr = 0;
|
||||||
|
|
||||||
|
#ifdef HAVE_AUTH
|
||||||
if (auth_dns)
|
if (auth_dns)
|
||||||
m = answer_auth(header, ((char *) header) + 65536, (size_t)size, now, &peer_addr);
|
m = answer_auth(header, ((char *) header) + 65536, (size_t)size, now, &peer_addr);
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
/* m > 0 if answered from cache */
|
/* m > 0 if answered from cache */
|
||||||
m = answer_request(header, ((char *) header) + 65536, (size_t)size,
|
m = answer_request(header, ((char *) header) + 65536, (size_t)size,
|
||||||
|
|||||||
Reference in New Issue
Block a user