[Dnsmasq-discuss] dnsmasq + huge number of domains or hosts

2024-07-06 Thread Leonid Evdokimov
len(label)].lower() for label in line.strip().encode('ascii').split(b'.')]).decode('ascii')) Thanks in advance :-) -- WBRBW, Leonid Evdokimov, https://darkk.net.ru tel:+79816800702 PGP: 6691 DE6B 4CCD C1C1 76A0 0D4A E1F2 A980 7F50 FAB2 __

Re: [Dnsmasq-discuss] Fix RNG entropy reuse, replace SURF with ChaCha8

2024-10-09 Thread Leonid Evdokimov
security bug and improving code size a bit. My goal of this specific submission is to reduce my local patch-stack to ease further rebasing & merging. I would be happy to see those patches either merged or declined explicitly, but it's not up to me to decide. :-) -- WBRBW, Leonid Evdoki

[Dnsmasq-discuss] [PATCH 6/6] Use ChaCha8-based {rand16, rand32, rand64}

2024-10-04 Thread Leonid Evdokimov
surf() takes 18256 cycles to generate u32[8*2] and needs ~290 opcodes. chacha8() either takes 4086 cycles to generate same amount of entropy with just ~100 opcodes, or 1944 cycles with 320 opcodes depending on QUARTERROUND() inlining. `gcc-13.2.0 -Os -mips32r2 -mtune=24kc -mips16` gives following

[Dnsmasq-discuss] [PATCH 2/6] Make in128++ branchless in SURF rand()

2024-10-04 Thread Leonid Evdokimov
It's equally fast, but it's measurably smaller. --- src/util.c | 34 +++--- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git src/util.c src/util.c index fefa8333..c27d77c4 100644 --- src/util.c +++ src/util.c @@ -61,6 +61,10 @@ static void surf(void) u32

[Dnsmasq-discuss] [PATCH 4/6] Rekey PRNG on fork() to avoid sharing PRNG state and/or leaking it

2024-10-04 Thread Leonid Evdokimov
--- src/dnsmasq.c | 6 +++--- src/dnsmasq.h | 1 + src/helper.c | 4 ++-- src/util.c| 21 + 4 files changed, 27 insertions(+), 5 deletions(-) diff --git src/dnsmasq.c src/dnsmasq.c index a9f26ae3..d15177f8 100644 --- src/dnsmasq.c +++ src/dnsmasq.c @@ -607,7 +607,7 @@

[Dnsmasq-discuss] [PATCH 5/6] Reseed with getentropy() ~hourly to avoid low-entropy on boot

2024-10-04 Thread Leonid Evdokimov
--- src/dnsmasq.c| 10 +++--- src/dnsmasq.h| 1 + src/hash-questions.c | 2 ++ src/util.c | 47 +++- 4 files changed, 48 insertions(+), 12 deletions(-) diff --git src/dnsmasq.c src/dnsmasq.c index d15177f8..68c290a3 100644 --

[Dnsmasq-discuss] [PATCH 1/6] Fix -Wshadow: rand64() was mistakenly using its own counter O_o

2024-10-04 Thread Leonid Evdokimov
It might be security vulnerability as rand64() is basically transmitted to network in address6_allocate() and it might expose values for some of next rand16() and rand32() calls as no other function calls rand64(). --- src/util.c | 2 -- 1 file changed, 2 deletions(-) diff --git src/util.c src/ut

[Dnsmasq-discuss] [PATCH 0/6] Fix RNG entropy reuse, replace SURF with ChaCha8

2024-10-04 Thread Leonid Evdokimov
8 is faster & smaller than SURF and, I assume, it's equally good for this use-case. I'm submitting these patches as a patch train hoping that it eases review as the patches deal with a one issue at a time. Leonid Evdokimov (6): Fix -Wshadow: rand64() was mistakenly using its own

[Dnsmasq-discuss] [PATCH 3/6] Use getentropy() if possible to reduce code duplication a bit

2024-10-04 Thread Leonid Evdokimov
It reduces binary by ~80 bytes on x86_64 :-) --- src/config.h | 8 src/util.c | 25 ++--- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git src/config.h src/config.h index e722e986..b86a53f3 100644 --- src/config.h +++ src/config.h @@ -144,6 +144,9 @@ HA

Re: [Dnsmasq-discuss] Fix RNG entropy reuse, replace SURF with ChaCha8

2024-10-14 Thread Leonid Evdokimov
nsmasq/compare/ready-for-review-01-chacha8-prng...ready-for-review-02-memory-usage I'll try to keep branches rebased on top of the main branch for a while. -- WBRBW, Leonid Evdokimov, https://darkk.net.ru tel:+79816800702 PGP: 6691 DE6B 4

Re: [Dnsmasq-discuss] About resolution performance and adblock

2024-11-20 Thread Leonid Evdokimov
et. We can't know if it'll be merged to the main dnsmasq repo, but extra testing and feedback kinda increases chances of that happening :-) [1] https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2024q3/017627.html -- WBRBW, Leonid Evdokimov, https://darkk.net.ru tel:+79816800702 P