mirror of
https://github.com/pi-hole/FTL.git
synced 2026-07-08 07:53:45 +01:00
bb89fbfe7b767d7b7bf9fd714efa40245fbb45d9
Add pytest tests for all previously untested GET API endpoints: dns/blocking, domains (all type/kind combinations and single lookup), groups, stats/summary, stats/top_domains, stats/top_clients, stats/upstreams, stats/query_types, stats/recent_blocked, stats/database (error handling), dhcp/leases, endpoints, info/ftl, info/login, info/version, info/messages, info/client, info/database, info/system, network/devices, network/interfaces, logs (dnsmasq, ftl, webserver), and padd. All assertions use exact expected values derived from the deterministic BATS DNS query seeding (137 total queries, 49 blocked, 47 forwarded, 41 cached, 11 active clients, 8 gravity domains). On failure, the full JSON response is dumped to /tmp/ftl_test_*.json for easy inspection. Fix double-free bug in printFTLenv() (src/config/env.c): when printFTLenv() was called more than once (e.g. after config reload triggered by the CLI password test), it would free item->error a second time because neither the pointer nor the error_allocated flag were reset after the first free. This produced "Trying to free NULL pointer in printFTLenv()" warnings. Fix: set item->error = NULL and item->error_allocated = false after freeing. Files modified: src/config/env.c — reset error/error_allocated after free test/api/test_api.py — add 34 new endpoint tests (22 -> 56 total) Signed-off-by: Dominik <dl6er@dl6er.de>
Network-wide ad blocking via your own Linux hardware
FTLDNS (pihole-FTL) provides an interactive API and also generates statistics for Pi-hole®'s Web interface.
- Fast: stats are read directly from memory by coupling our codebase closely with
dnsmasq - Versatile: upstream changes to
dnsmasqcan quickly be merged in without much conflict - Lightweight: runs smoothly with minimal hardware and software requirements such as Raspberry Pi Zero
- Interactive: our API can be used to interface with your projects
- Insightful: stats normally reserved inside of
dnsmasqare made available so you can see what's really happening on your network
Official documentation
The official FTLDNS documentation can be found here.
Installation
FTLDNS (pihole-FTL) is automatically installed when installing Pi-hole.
IMPORTANT
FTLDNS will disable any existing installations of
dnsmasq. This is because FTLDNS isdnsmasq+ Pi-hole's code, so both cannot run simultaneously.
Languages
C
96.9%
C++
1.1%
Python
0.9%
Shell
0.7%
CMake
0.3%