Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update embedded dnsmasq to v2.87test8 #1281

Merged
merged 37 commits into from
Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
18a48b3
Implements a SetLocaliseQueriesOption D-Bus method. For setting the s…
Jan 6, 2022
e3d57af
Handle malformed query packets sensibly.
simonkelley Jan 9, 2022
408dd13
Overhaul code which sends DNSSEC queries.
simonkelley Jan 11, 2022
2d65d55
Log port numbers in server addresses when non-standard ports in use.
simonkelley Jan 11, 2022
0eacb40
Fix header of cache dump. The width of the host and address fields ar…
DL6ER Dec 18, 2021
44611db
Extend cache dump: "!" as type for non-terminals, new flag "C" for co…
DL6ER Dec 30, 2021
5850a53
Log source of ignored query when local-service is used.
simonkelley Jan 11, 2022
9522a51
Fix FTBFS when HAVE_DNSSEC not defined.
simonkelley Jan 11, 2022
9f2e225
Add root group writeable flag to log file
pemensik Jan 10, 2022
e96987d
Use upstream destination port as reported by dnsmasq instead of rever…
DL6ER Jan 12, 2022
380eaab
Tests: Adjust expected dnsmasq warnings
DL6ER Jan 12, 2022
d7c2043
Query type is overloaded with port since 2d65d55, so we have to deriv…
DL6ER Jan 12, 2022
0965995
Small fix to ff43d35aeef6178f7471c6f37e91845c9a72bd2f
simonkelley Jan 12, 2022
c037cc0
Fix error introduced in 11c52d032be7a111094419194fc8cb03802d0edf
simonkelley Jan 12, 2022
97ba9c3
Fix DNSSEC failure to validate unsigned NoDATA replies.
simonkelley Jan 13, 2022
882563a
Minimum safe size is recommended to be 1232. See https://dnsflagday.n…
DL6ER Dec 28, 2021
08ccfeb
Strip EDNS(0) Client Subnet / MAC information if --strip-subnet or --…
DL6ER Jan 7, 2022
563b45d
Tidy previous commit and add manpage entries for new options.
simonkelley Jan 15, 2022
ad4712b
Merge branch 'development' into update/dnsmasq
DL6ER Jan 16, 2022
e7974ae
Remove temporary debugging message and close related Debian bug.
simonkelley Jan 17, 2022
a20aec1
Fix crash in PXE code with bad config.
simonkelley Jan 18, 2022
c365593
Fix indentation in Umbrella option code.
simonkelley Jan 21, 2022
5a8a063
Merge branch 'development' into update/dnsmasq
DL6ER Feb 3, 2022
d74eed5
Bump copyright to 2022.
simonkelley Jan 24, 2022
c74158c
Extend packet-dump system to DHCP and TFTP.
DL6ER Feb 3, 2022
172c60f
Extend packet dump system to RA.
simonkelley Jan 29, 2022
e0d0daf
Handle options other than source link-layer address in router solicit…
simonkelley Jan 29, 2022
ea50869
Dump.c Fix IPv6 checksum on big-endian.
simonkelley Jan 30, 2022
82ac2ee
Improve the performance of DHCP relay.
simonkelley Feb 1, 2022
920000a
Handle changing interface indexes when binding DHCP sockets.
simonkelley Feb 3, 2022
e6c4c29
Fix FTBFS on BSD platforms.
Feb 3, 2022
3f472e9
Merge branch 'development' into update/dnsmasq
DL6ER Feb 5, 2022
ec386cc
Tidy iface_check().
simonkelley Jan 21, 2022
fd244b2
Merge branch 'development' into update/dnsmasq
DL6ER Feb 6, 2022
5bd230a
Ask netlink for new address events unconditionally.
simonkelley Feb 4, 2022
584e752
Add --conf-script
simonkelley Feb 8, 2022
1a9a7aa
Update dnsmasq version
DL6ER Feb 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
cmake_minimum_required(VERSION 2.8.12)
project(PIHOLE_FTL C)

set(DNSMASQ_VERSION pi-hole-2.87test4-18)
set(DNSMASQ_VERSION pi-hole-2.87test8)

add_subdirectory(src)
2 changes: 1 addition & 1 deletion src/dnsmasq/arp.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* dnsmasq is Copyright (c) 2000-2021 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2022 Simon Kelley

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion src/dnsmasq/auth.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* dnsmasq is Copyright (c) 2000-2021 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2022 Simon Kelley

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion src/dnsmasq/blockdata.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* dnsmasq is Copyright (c) 2000-2021 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2022 Simon Kelley

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion src/dnsmasq/bpf.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* dnsmasq is Copyright (c) 2000-2021 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2022 Simon Kelley

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
46 changes: 30 additions & 16 deletions src/dnsmasq/cache.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* dnsmasq is Copyright (c) 2000-2021 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2022 Simon Kelley

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -1797,7 +1797,8 @@ void dump_cache(time_t now)
{
struct crec *cache ;
int i;
my_syslog(LOG_INFO, "Host Address Flags Expires");
my_syslog(LOG_INFO, "Host Address Flags Expires Source");
my_syslog(LOG_INFO, "------------------------------ ---------------------------------------- ---------- ------------------------ ------------");

for (i=0; i<hash_size; i++)
for (cache = hash_table[i]; cache; cache = cache->hash_next)
Expand Down Expand Up @@ -1855,22 +1856,27 @@ void dump_cache(time_t now)
else if (cache->flags & F_DNSKEY)
t = "K";
#endif
p += sprintf(p, "%-40.40s %s%s%s%s%s%s%s%s%s ", a, t,
else /* non-terminal */
t = "!";

p += sprintf(p, "%-40.40s %s%s%s%s%s%s%s%s%s%s ", a, t,
cache->flags & F_FORWARD ? "F" : " ",
cache->flags & F_REVERSE ? "R" : " ",
cache->flags & F_IMMORTAL ? "I" : " ",
cache->flags & F_DHCP ? "D" : " ",
cache->flags & F_NEG ? "N" : " ",
cache->flags & F_NXDOMAIN ? "X" : " ",
cache->flags & F_HOSTS ? "H" : " ",
cache->flags & F_CONFIG ? "C" : " ",
cache->flags & F_DNSSECOK ? "V" : " ");
#ifdef HAVE_BROKEN_RTC
p += sprintf(p, "%lu", cache->flags & F_IMMORTAL ? 0: (unsigned long)(cache->ttd - now));
p += sprintf(p, "%-24lu", cache->flags & F_IMMORTAL ? 0: (unsigned long)(cache->ttd - now));
#else
p += sprintf(p, "%s", cache->flags & F_IMMORTAL ? "\n" : ctime(&(cache->ttd)));
/* ctime includes trailing \n - eat it */
*(p-1) = 0;
p += sprintf(p, "%-24.24s", cache->flags & F_IMMORTAL ? "" : ctime(&(cache->ttd)));
#endif
if(cache->flags & (F_HOSTS | F_CONFIG) && cache->uid > 0)
p += sprintf(p, " %s", record_source(cache->uid));

my_syslog(LOG_INFO, "%s", daemon->namebuff);
}
}
Expand Down Expand Up @@ -1994,14 +2000,15 @@ void _log_query(unsigned int flags, char *name, union all_addr *addr, char *arg,
char *source, *dest = arg;
char *verb = "is";
char *extra = "";
char portstring[7]; /* space for #<portnum> */

FTL_hook(flags, name, addr, arg, daemon->log_display_id, type, file, line);

if (!option_bool(OPT_LOG))
return;

/* build query type string if requested */
if(type > 0)
if (!(flags & (F_SERVER | F_IPSET)) && type > 0)
arg = querystr(arg, type);

#ifdef HAVE_DNSSEC
Expand Down Expand Up @@ -2037,8 +2044,15 @@ void _log_query(unsigned int flags, char *name, union all_addr *addr, char *arg,
}
}
else if (flags & (F_IPV4 | F_IPV6))
inet_ntop(flags & F_IPV4 ? AF_INET : AF_INET6,
addr, daemon->addrbuff, ADDRSTRLEN);
{
inet_ntop(flags & F_IPV4 ? AF_INET : AF_INET6,
addr, daemon->addrbuff, ADDRSTRLEN);
if ((flags & F_SERVER) && type != NAMESERVER_PORT)
{
extra = portstring;
sprintf(portstring, "#%u", type);
}
}
else
dest = arg;
}
Expand Down Expand Up @@ -2090,7 +2104,12 @@ void _log_query(unsigned int flags, char *name, union all_addr *addr, char *arg,
}
else if (flags & F_AUTH)
source = "auth";
else if (flags & F_SERVER)
else if (flags & F_DNSSEC)
{
source = arg;
verb = "to";
}
else if (flags & F_SERVER)
{
source = "forwarded";
verb = "to";
Expand All @@ -2100,11 +2119,6 @@ void _log_query(unsigned int flags, char *name, union all_addr *addr, char *arg,
source = arg;
verb = "from";
}
else if (flags & F_DNSSEC)
{
source = arg;
verb = "to";
}
else if (flags & F_IPSET)
{
source = type ? "ipset add" : "nftset add";
Expand Down
4 changes: 2 additions & 2 deletions src/dnsmasq/config.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* dnsmasq is Copyright (c) 2000-2021 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2022 Simon Kelley

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -20,7 +20,7 @@
#define TCP_MAX_QUERIES 100 /* Maximum number of queries per incoming TCP connection */
#define TCP_BACKLOG 32 /* kernel backlog limit for TCP connections */
#define EDNS_PKTSZ 4096 /* default max EDNS.0 UDP packet from RFC5625 */
#define SAFE_PKTSZ 1280 /* "go anywhere" UDP packet size */
#define SAFE_PKTSZ 1232 /* "go anywhere" UDP packet size, see https://dnsflagday.net/2020/ */
#define KEYBLOCK_LEN 40 /* choose to minimise fragmentation when storing DNSSEC keys */
#define DNSSEC_WORK 50 /* Max number of queries to validate one question */
#define TIMEOUT 10 /* drop UDP queries after TIMEOUT seconds */
Expand Down
2 changes: 1 addition & 1 deletion src/dnsmasq/conntrack.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* dnsmasq is Copyright (c) 2000-2021 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2022 Simon Kelley

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion src/dnsmasq/crypto.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* dnsmasq is Copyright (c) 2000-2021 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2022 Simon Kelley

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
9 changes: 8 additions & 1 deletion src/dnsmasq/dbus.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* dnsmasq is Copyright (c) 2000-2021 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2022 Simon Kelley

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -52,6 +52,9 @@ const char* introspection_xml_template =
" <method name=\"SetFilterWin2KOption\">\n"
" <arg name=\"filterwin2k\" direction=\"in\" type=\"b\"/>\n"
" </method>\n"
" <method name=\"SetLocaliseQueriesOption\">\n"
" <arg name=\"localise-queries\" direction=\"in\" type=\"b\"/>\n"
" </method>\n"
" <method name=\"SetBogusPrivOption\">\n"
" <arg name=\"boguspriv\" direction=\"in\" type=\"b\"/>\n"
" </method>\n"
Expand Down Expand Up @@ -694,6 +697,10 @@ DBusHandlerResult message_handler(DBusConnection *connection,
{
reply = dbus_set_bool(message, OPT_FILTER, "filterwin2k");
}
else if (strcmp(method, "SetLocaliseQueriesOption") == 0)
{
reply = dbus_set_bool(message, OPT_LOCALISE, "localise-queries");
}
else if (strcmp(method, "SetBogusPrivOption") == 0)
{
reply = dbus_set_bool(message, OPT_BOGUSPRIV, "bogus-priv");
Expand Down
40 changes: 35 additions & 5 deletions src/dnsmasq/dhcp-common.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* dnsmasq is Copyright (c) 2000-2021 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2022 Simon Kelley

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -566,20 +566,50 @@ char *whichdevice(void)
}

if (found)
return found->name;

{
char *ret = safe_malloc(strlen(found->name)+1);
strcpy(ret, found->name);
return ret;
}

return NULL;
}

void bindtodevice(char *device, int fd)
static int bindtodevice(char *device, int fd)
{
size_t len = strlen(device)+1;
if (len > IFNAMSIZ)
len = IFNAMSIZ;
/* only allowed by root. */
if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, device, len) == -1 &&
errno != EPERM)
die(_("failed to set SO_BINDTODEVICE on DHCP socket: %s"), NULL, EC_BADNET);
return 2;

return 1;
}

int bind_dhcp_devices(char *bound_device)
{
int ret = 0;

if (bound_device)
{
if (daemon->dhcp)
{
if (!daemon->relay4)
ret |= bindtodevice(bound_device, daemon->dhcpfd);

if (daemon->enable_pxe && daemon->pxefd != -1)
ret |= bindtodevice(bound_device, daemon->pxefd);
}

#if defined(HAVE_DHCP6)
if (daemon->doing_dhcp6 && !daemon->relay6)
ret |= bindtodevice(bound_device, daemon->dhcp6fd);
#endif
}

return ret;
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/dnsmasq/dhcp-protocol.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* dnsmasq is Copyright (c) 2000-2021 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2022 Simon Kelley

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
Loading