From 2b1a58bf9b1d1bd492eb1012dcba467a0069e364 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Fri, 11 Jan 2019 21:51:15 -0800 Subject: [PATCH 1/3] Mark queries imported from the database as having an unknown DNSSEC type Also explicity marks the queries with an unknown reply type. However, this was already happening before, because `REPLY_UNKNOWN` equals 0, and the struct is zero-initialized. Signed-off-by: Mcat12 --- database.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/database.c b/database.c index 7dcb6cba..24016091 100644 --- a/database.c +++ b/database.c @@ -741,6 +741,8 @@ void read_data_from_DB(void) queries[queryIndex].complete = true; // Mark as all information is avaiable queries[queryIndex].response = 0; queries[queryIndex].AD = false; + queries[queryIndex].dnssec = DNSSEC_UNKNOWN; + queries[queryIndex].reply = REPLY_UNKNOWN; lastDBimportedtimestamp = queryTimeStamp; // Handle type counters From bfcaa9f41208aca1ca017c738fffc0fd750d2d14 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Sat, 19 Jan 2019 13:41:22 -0800 Subject: [PATCH 2/3] Use armv6 soft-float for the arm build There have been a few issues trying to support armv6 hard-float, notably nettle crashes even when not using DNSSEC. This change will also increase the amount of devices able to run FTL by supporting armv6 devices without hard-float. The performance impact is expected to be low. Signed-off-by: Mcat12 --- docker/arm/Dockerfile | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/docker/arm/Dockerfile b/docker/arm/Dockerfile index c7505f60..5d4230c2 100644 --- a/docker/arm/Dockerfile +++ b/docker/arm/Dockerfile @@ -1,22 +1,8 @@ FROM debian:stretch -RUN dpkg --add-architecture armhf && \ +RUN dpkg --add-architecture armel && \ apt-get update && \ - apt-get install -y --no-install-recommends nettle-dev:armhf \ - make file wget netcat-traditional sqlite3 git ca-certificates ssh + apt-get install -y --no-install-recommends nettle-dev:armel gcc-arm-linux-gnueabi libc6-dev-armel-cross \ + make file wget netcat-traditional sqlite3 git ca-certificates ssh libcap-dev:armel -# Use Raspbian's GCC -# This command was taken from https://github.com/dockcross/dockcross/blob/master/linux-armv6/Dockerfile -# Slightly modified from the original -RUN mkdir rpi_tools && cd rpi_tools && git init && git remote add origin https://github.com/raspberrypi/tools && \ - git config core.sparseCheckout true && \ - echo "arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64" >> .git/info/sparse-checkout && \ - git pull --depth=1 origin master && \ - cp -a arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/* /usr/ && rm -rf ../rpi_tools - -RUN wget ftl.pi-hole.net/libraries/libgmp.a -O /usr/local/lib/libgmp.a && \ - wget ftl.pi-hole.net/libraries/libnettle.a -O /usr/local/lib/libnettle.a && \ - wget ftl.pi-hole.net/libraries/libhogweed.a -O /usr/local/lib/libhogweed.a - -# Allow libnettle to be used, because this GCC doesn't have all the right header and library directories -ENV CC "arm-linux-gnueabihf-gcc -I/usr/include -I/usr/include/arm-linux-gnueabihf" +ENV CC arm-linux-gnueabi-gcc From a766880470c2df4dcc900dda6aed1ae6e7072259 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sun, 20 Jan 2019 10:43:53 +0100 Subject: [PATCH 3/3] Ensure that the loop in findQueryID() cannot start with negative indices. This was the case when there where zero queries in the memory. Signed-off-by: DL6ER --- dnsmasq_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dnsmasq_interface.c b/dnsmasq_interface.c index 6f5198b6..719767da 100644 --- a/dnsmasq_interface.c +++ b/dnsmasq_interface.c @@ -229,9 +229,9 @@ static int findQueryID(int id) // Validate access only once for the maximum index (all lower will work) validate_access("queries", counters->queries-1, false, __LINE__, __FUNCTION__, __FILE__); int until = MAX(0, counters->queries-MAXITER); - int i; + int start = MAX(0, counters->queries-1); // Check UUIDs of queries - for(i = counters->queries-1; i >= until; i--) + for(int i = start; i >= until; i--) if(queries[i].id == id) return i;