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.90 (Pi-hole v5) #1881

Merged
merged 24 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b650631
Log truncated DNS replies.
simonkelley May 17, 2023
d38a0a6
Necessary changed to handle the most recent dnsmasq changes in FTL
DL6ER May 27, 2023
6b48e6d
Behave better when attempting to contact unresponsive TCP servers.
simonkelley May 26, 2023
6cc10f7
=/== typo in last commit.
simonkelley May 26, 2023
0a90f07
Update changed indentation of known DNSMASQ warning
DL6ER May 27, 2023
45c342a
Force-update embedded dnsmasq version. We are loosing the individual …
DL6ER Feb 8, 2024
cc98853
Tweak logging and special handling of T_ANY in rr-filter code.
simonkelley Feb 12, 2024
9091f18
Make --filter-rr=ANY filter the answer to ANY queries.
simonkelley Feb 12, 2024
91b924d
Update embedded dnsmasq version to 2.90test4
DL6ER Feb 13, 2024
108ab67
Protection against pathalogical DNSSEC domains.
simonkelley Dec 30, 2023
bf17dd3
Update header with new EDE values.
simonkelley Dec 31, 2023
70b0431
Update NSEC3 iterations handling to conform with RFC 9276.
simonkelley Dec 31, 2023
dd11688
Measure cryptographic work done by DNSSEC.
simonkelley Jan 1, 2024
2e0d8ff
Fix error introduced in 635bc51cac3d5d7dd49ce9e27149cf7e402b7e79
simonkelley Jan 2, 2024
a133029
Parameterise work limits for DNSSEC validation.
simonkelley Jan 2, 2024
8b9c5d3
Update EDE code -> text conversion.
simonkelley Jan 4, 2024
0ce9541
Rework validate-by-DS to avoid DoS vuln without arbitrary limits.
simonkelley Jan 4, 2024
c32b467
Overhaul data checking in NSEC code.
simonkelley Jan 5, 2024
a389bcc
Better stats and logging from DNSSEC resource limiting.
simonkelley Jan 6, 2024
c3bc0f9
Better allocation code for DS digest cache.
simonkelley Jan 6, 2024
fbc5713
Add --dnssec-limits option.
simonkelley Jan 7, 2024
65402b1
Reverse suppression of ANY query answer logging.
simonkelley Feb 13, 2024
3e32d96
Update expected dnsmasq warnings
DL6ER Feb 13, 2024
3bb1fcf
Update dnsmasq version to 2.90
DL6ER Feb 13, 2024
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-v2.89-9461807)
set(DNSMASQ_VERSION pi-hole-v2.90)

add_subdirectory(src)
2 changes: 1 addition & 1 deletion src/args.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ void parse_args(int argc, char* argv[])
const char *arg[2];
arg[0] = "";
arg[1] = "--test";
exit(main_dnsmasq(2, arg));
exit(main_dnsmasq(2, (char**)arg));
}

// If we find "--" we collect everything behind that for dnsmasq
Expand Down
10 changes: 10 additions & 0 deletions src/dnsmasq/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Pi-hole: A black hole for Internet advertisements
# (c) 2020 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your own hardware.
#
# FTL Engine
# /src/dnsmasq/CMakeList.txt
#
# This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license.

set(sources
arp.c
auth.c
Expand Down
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-2022 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2024 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-2022 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2024 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
123 changes: 93 additions & 30 deletions src/dnsmasq/blockdata.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* dnsmasq is Copyright (c) 2000-2022 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2024 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 @@ -19,7 +19,7 @@
static struct blockdata *keyblock_free;
static unsigned int blockdata_count, blockdata_hwm, blockdata_alloced;

static void blockdata_expand(int n)
static void add_blocks(int n)
{
struct blockdata *new = whine_malloc(n * sizeof(struct blockdata));

Expand Down Expand Up @@ -47,7 +47,7 @@ void blockdata_init(void)

/* Note that daemon->cachesize is enforced to have non-zero size if OPT_DNSSEC_VALID is set */
if (option_bool(OPT_DNSSEC_VALID))
blockdata_expand(daemon->cachesize);
add_blocks(daemon->cachesize);
}

void blockdata_report(void)
Expand All @@ -58,50 +58,61 @@ void blockdata_report(void)
blockdata_alloced * sizeof(struct blockdata));
}

static struct blockdata *new_block(void)
{
struct blockdata *block;

if (!keyblock_free)
add_blocks(50);

if (keyblock_free)
{
block = keyblock_free;
keyblock_free = block->next;
blockdata_count++;
if (blockdata_hwm < blockdata_count)
blockdata_hwm = blockdata_count;
block->next = NULL;
return block;
}

return NULL;
}

static struct blockdata *blockdata_alloc_real(int fd, char *data, size_t len)
{
struct blockdata *block, *ret = NULL;
struct blockdata **prev = &ret;
size_t blen;

while (len > 0)
do
{
if (!keyblock_free)
blockdata_expand(50);

if (keyblock_free)
{
block = keyblock_free;
keyblock_free = block->next;
blockdata_count++;
}
else
if (!(block = new_block()))
{
/* failed to alloc, free partial chain */
blockdata_free(ret);
return NULL;
}

if (blockdata_hwm < blockdata_count)
blockdata_hwm = blockdata_count;

blen = len > KEYBLOCK_LEN ? KEYBLOCK_LEN : len;
if (data)
{
memcpy(block->key, data, blen);
data += blen;
}
else if (!read_write(fd, block->key, blen, 1))

if ((blen = len > KEYBLOCK_LEN ? KEYBLOCK_LEN : len) > 0)
{
/* failed read free partial chain */
blockdata_free(ret);
return NULL;
if (data)
{
memcpy(block->key, data, blen);
data += blen;
}
else if (!read_write(fd, block->key, blen, 1))
{
/* failed read free partial chain */
blockdata_free(ret);
return NULL;
}
}

len -= blen;
*prev = block;
prev = &block->next;
block->next = NULL;
}
} while (len != 0);

return ret;
}
Expand All @@ -111,6 +122,58 @@ struct blockdata *blockdata_alloc(char *data, size_t len)
return blockdata_alloc_real(0, data, len);
}

/* Add data to the end of the block.
newlen is length of new data, NOT total new length.
Use blockdata_alloc(NULL, 0) to make empty block to add to. */
int blockdata_expand(struct blockdata *block, size_t oldlen, char *data, size_t newlen)
{
struct blockdata *b;

/* find size of current final block */
for (b = block; oldlen > KEYBLOCK_LEN && b; b = b->next, oldlen -= KEYBLOCK_LEN);

/* chain to short for length, something is broken */
if (oldlen > KEYBLOCK_LEN)
{
blockdata_free(block);
return 0;
}

while (1)
{
struct blockdata *new;
size_t blocksize = KEYBLOCK_LEN - oldlen;
size_t size = (newlen <= blocksize) ? newlen : blocksize;

if (size != 0)
{
memcpy(&b->key[oldlen], data, size);
data += size;
newlen -= size;
}

/* full blocks from now on. */
oldlen = 0;

if (newlen == 0)
break;

if ((new = new_block()))
{
b->next = new;
b = new;
}
else
{
/* failed to alloc, free partial chain */
blockdata_free(block);
return 0;
}
}

return 1;
}

void blockdata_free(struct blockdata *blocks)
{
struct blockdata *tmp;
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-2022 Simon Kelley
/* dnsmasq is Copyright (c) 2000-2024 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
Loading