Commit Graph
45 Commits
Author SHA1 Message Date
DL6ER 25eb416f92 Remove memory sub-structure
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-06-23 15:02:36 +02:00
DL6ER 2ae4b52bb3 A number of improvements:
- use "extern" for the glibal variable specifications in the header files (and clarif where the variables are actually defined)
- record number of failed requests to forward destinations
- Add dnsmasq_interface.h to DTLDEPS
- Add new request type ">cacheinfo" to get information about cache usage in the resolver

Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-02-26 17:24:09 +01:00
DL6ER ea3309e7b1 Initial commit for FTLDNS
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-02-22 20:21:06 +01:00
Mcat12 5341b18ecf Handle possible pack_fixstr or pack_str32 error
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-21 15:40:58 -05:00
Mcat12 7c57b86443 Reword api.h license description header
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-20 11:14:42 -05:00
Mcat12 071f924f70 Remove the rest of the DNS commands and unused helpers
They now live in the API

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-12 14:55:24 -05:00
Mcat12 cf2aff7b16 Remove addList
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-11 22:20:43 -05:00
Mcat12 3158f17701 Remove getPiholeStatus
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-11 20:46:25 -05:00
Mcat12 7d877223f4 Remove getList
Most DNS endpoints will be implemented in the API to keep FTL focused
on providing stats.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-11 16:54:36 -05:00
Mcat12 b9780dc295 Reimplement output for getPiholeStatus
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-10 23:05:05 -05:00
Mcat12 f02c4e81a5 Reimplement output for getList
Adds `>getWhitelist`, `>getBlacklist`, and `getWildlist`

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-10 22:46:45 -05:00
Mcat12 da7c354b71 Add socket implementation to getUnknownQueries and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-07 23:29:16 -05:00
Mcat12 64a1408e5d Add socket implementation of getDBstats and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-07 22:51:04 -05:00
Mcat12 2671a6fde0 Add socket implementation of getVersion and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-07 22:40:30 -05:00
Mcat12 779a82468e Add socket implementation to getQueryTypesOverTime and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-07 22:29:06 -05:00
Mcat12 08143393f0 Add socket implementation to getClientID and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-07 22:23:01 -05:00
Mcat12 7d0f680347 Add socket implementation to getForwardDestinationsOverTime and istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-07 22:19:20 -05:00
Mcat12 81200a270d Add socket implementation to getMemoryUsage and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-07 21:10:14 -05:00
Mcat12 555a0cbc6c Add socket implementation to getRecentBlocked and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-07 15:48:09 -05:00
Mcat12 3f1ffafc8f Add socket implementation to getQueryTypes and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-07 15:24:48 -05:00
Mcat12 33dd350370 Add socket implementation to getForwardDestinations and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-07 14:53:11 -05:00
Mcat12 00f8877232 Add socket implementation to getTopClients and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-06 23:10:35 -05:00
Mcat12 05f86041cf Add socket implementation to getTopDomains and use istelnet
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-06 22:28:41 -05:00
Mcat12 7d3dfb6351 Don't send fixarray for getAllQueries
It's unnecessary

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-06 12:33:13 -05:00
Mcat12 348a2ee81e Add socket implementation for getAllQueries
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-06 00:46:20 -05:00
Mcat12 4eaf794b63 Tighten parameters on pack_unsigned_char
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-05 22:48:43 -05:00
Mcat12 adfcaccb36 Use istelnet for getAllQueries
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-05 22:36:19 -05:00
Mcat12 c0022a95c9 Use istelnet for getOverTime
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-05 22:15:55 -05:00
Mcat12 e54b3913f9 Add socket implementation for getOverTime
Adds the map16 structure to msgpack.c and tightens the pack_int
signature to only accept int32_t types.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-05 22:14:36 -05:00
DL6ER f0793be61b Use istelnet[] in getStats()
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-04 19:33:20 +01:00
Mcat12 e527985371 Implement getStats using MessagePack
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-04 12:04:04 -05:00
Mcat12 595ab259ca Remove HTTP API specific code so it can be replaced with a new protocol
Adjusted tests to fit the current lack of output on the unix socket.
Added TELNET enum and used it in place of the old SOCKET to better fit
with the rest of the code base.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-03 20:16:50 -05:00
Mcat12 8adb3d335e Merge remote-tracking branch 'origin/development' into new/API
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-03 14:35:42 -05:00
Mcat12 6050aa5ad7 Add IP address into the authentication check
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-12-25 23:56:56 -05:00
Mcat12 5005f285ec Implement simple password-protection to the HTTP API
Currently has the hardcoded password of "password". You gain a session
by sending JSON to the API with the key of `password` and the value
set to the password you are trying to use. Then it will return a success
response with the session and will add a Set-Cookie header to set the
FTL_SESSION cookie to the session number.

The summary, queries graph, and status are accessible without
authentication.

The internal data structure used to store the sessions is valid for up
to 24 minutes after the last query. If it becomes invalid then it is
eligible to be reused for a new session. The garbage collection can be
optimized further, but it is not a problem at the moment.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-12-24 16:11:46 -05:00
Mcat12 604ad7ec39 Merge remote-tracking branch 'origin/development' into new/API
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>

# Conflicts:
#	request.c
#	test/test_suite.sh
2017-12-22 23:08:18 -05:00
Mcat12 3331c42971 Move getPayload to api.c
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-11-26 22:59:24 -05:00
Mcat12 e5c4d19aaa Merge remote-tracking branch 'origin/development' into new/API 2017-09-26 00:37:38 -04:00
Mcat12 1893aa5c25 Add whitelist and blacklist deletion API endpoints
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-08-10 23:10:44 -04:00
Mcat12 a743931d15 Improve API response method to use enums 2017-08-10 22:00:13 -04:00
Mcat12 3a5752d908 Actually add the domain to the list
This requires the `pihole` user to have sudo access to the `pihole`
command (will require a core update). Many future API commands will have
this requirement, as they too will be using the `pihole` command.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-08-09 22:40:33 -04:00
Mcat12 2f8e5409eb Check if domain is invalid
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-08-09 22:05:51 -04:00
Mcat12 9ec7bd8722 Implement simple JSON parsing for addList
Uses cJSON to parse, but output will still be handled directly.
I implemented different API response methods to allow for different HTTP
response codes to be sent.
The addList code is still dumb and doesn't do anything, but it's getting
there.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-08-09 21:28:38 -04:00
Mcat12 ebe0631e5c Add dummy POST handling for whitelist and blacklist
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-08-08 23:08:54 -04:00
Mcat12 4762b8a55c Reorganize to split up API functions
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-08-06 19:06:12 -04:00