Commit Graph

88 Commits

Author SHA1 Message Date
DL6ER ea3309e7b1 Initial commit for FTLDNS
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-02-22 20:21:06 +01:00
DL6ER e75bd26994 Improve overall memory handling by checking for failed memory allocation events at the places we need the allocated space
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-02-07 13:23:54 +01:00
Mcat12 590f1f97f7 Merge remote-tracking branch 'origin/development' into new/API
# Conflicts:
#	FTL.h
#	socket.c
2018-01-21 09:48:41 -05:00
DL6ER d12726a01b Only listen on IPv4 and IPv6 telnet sockets if we successfully bound to the corresponding port
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-21 14:01:22 +01:00
DL6ER df3b049ede Remove clientips[]
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-20 21:41:12 +01:00
DL6ER 0aee819dc2 Implement some of the review comments
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-20 21:38:24 +01:00
Mcat12 232507a51e Merge remote-tracking branch 'origin/development' into new/API 2018-01-20 11:21:36 -05:00
Mcat12 1fd7ade5fe Add back detailed ssend error message
Might have been lost in a merge.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-20 11:19:09 -05:00
DL6ER 084186af79 Add free() on an allocated buffer where I forgot it
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-16 18:32:19 +01:00
Mcat12 d3d70983ad Merge remote-tracking branch 'origin/development' into new/API
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>

# Conflicts:
#	main.c
#	request.c
#	routines.h
#	socket.c
2018-01-14 17:48:37 -05:00
DL6ER 8f38a22d8f Merge pull request #202 from pi-hole/tweak/socket_creation
Create sockets in order
2018-01-14 23:14:24 +01:00
DL6ER f709729277 Don't skip Unix socket when IPv6 is not available
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-14 20:06:43 +01:00
DL6ER 3bdf7c9844 Make sure sockets are created and bound to before continuing to launch other threads in main()
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-14 20:00:24 +01:00
Mcat12 31c422eae6 Fix checkClientLimit
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-12 17:37:44 -05:00
Mcat12 0013edb1c6 Merge remote-tracking branch 'origin/development' into new/API
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>

# Conflicts:
#	main.c
#	request.c
#	routines.h
#	socket.c
2018-01-12 17:12:08 -05:00
DL6ER d53371082f Replace sprintf() + swrite() by the new ssend() routine. This enhancement removes the fixed buffer we used before and allows for responses having arbitraty lengths
Signed-off-by: DL6ER <dl6er@dl6er.de>

Conflicts:
	request.c
	routines.h
2018-01-12 22:40:53 +01:00
DL6ER 5df4ea3cdd Remove obsolete comment
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-11 23:19:02 +01:00
DL6ER 51b645a01a Incorporate review comments
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-11 21:01:40 +01:00
DL6ER c6b23ffa15 Complete re-write of this feature. We create now two sockets (one for IPv4-only and one for IPv6-only) to be able to bind to the corresponding loopback interfaces. We listen independently, but handle incoming requests using the same code.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-10 18:02:45 +01:00
Mcat12 4ed20a4e8a Don't show a warning if write() returns 0 (this isn't an error)
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-09 16:07:58 -05:00
DL6ER 1eebc23c7c Disable debug statement
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-09 21:34:24 +01:00
DL6ER a95f683711 Detect if the current machine has IPv6 capable interfaces and behave accordingly (don't try to bind to a dual-stack port if the machine isn't capable to handling IPv6, e.g. in docker)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-09 21:30:10 +01:00
DL6ER 1254b74c93 dualstack will always bee boolean
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-09 19:59:10 +01:00
DL6ER 13b2fb3c35 Merge branch 'development' into new/IPv6support
Signed-off-by: DL6ER <dl6er@dl6er.de>

Conflicts:
	socket.c
2018-01-09 19:44:28 +01:00
DL6ER 203cc946bd Add istelnet array
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-04 19:31:23 +01:00
Mcat12 616b10a599 Add swrite function
It will print a warning if an error happens, like the other s* functions
in socket.c

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-04 12:28:40 -05:00
Mcat12 e527985371 Implement getStats using MessagePack
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-04 12:04:04 -05:00
Mcat12 97f6ac534a Remove extra parameter from bind_to_telnet_port
Since it has been specialized, it is only called to create the telnet
port.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-01-03 20:44:18 -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
DL6ER 7638d8cdb1 Improve socket client example + work on review comments
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-01 21:33:39 +01:00
DL6ER 8a720b6f19 Fix spelling
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-01 17:24:54 +01:00
DL6ER e67e5e45de Suppress connection interrupted messages for Telnet and Unix Socket
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-01 14:28:29 +01:00
DL6ER 54487db5cf Close unix socket and unlink file handle on exit of FTL
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-01 11:59:43 +01:00
DL6ER 7ad0c66b68 Remove debug output
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-01 11:32:31 +01:00
DL6ER 1f7dbaa403 :codacy:
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-01-01 00:56:39 +01:00
DL6ER 0387304b4c Answer Unix socket requests the exact same way we do already for the telnet interface
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-31 22:49:14 +01:00
DL6ER 3c39cb1fd2 Added Unix socket - it is listening!
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-31 22:44:08 +01:00
DL6ER e4cbe417a1 Rename existing telnet socket functions to contain "telnet" in their names to avoid confusion when adding Unix sockets
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-31 22:25:27 +01:00
DL6ER 80ec6b2826 Add client name determination for the fallback solution
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-26 12:36:53 +01:00
DL6ER 22e341280a Adjust client name determination
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-26 12:05:34 +01:00
DL6ER 9d7617f3c7 Add IPv4-only fallback if dual-stack socket is not available
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-26 11:55:26 +01:00
DL6ER b506aab469 Add full IPv6 support for FTL socket connections
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-26 11:31:07 +01:00
Mcat12 c9e40a4b41 Free client IP data after API handler runs and close rejected sockets
Also added more debugclients logging.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-12-25 23:33:49 -05:00
Mcat12 f15b9ed8ac Make sure the API handler ignores clients when over the limit
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-12-25 17:41:04 -05:00
DL6ER cd2fd11806 Make client IPs globally available in FTL (array of strings clientip[sockedidentifier]) for possible use in authentication
Signed-off-by: DL6ER <dl6er@dl6er.de>
2017-12-25 12:24:28 +01:00
Mcat12 729d5d4ea9 Respond to CORS preflight (OPTIONS) 2017-08-11 21:49:47 -04:00
Mcat12 06be1c4806 Move debug API request logging to see all requests 2017-08-11 21:05:07 -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 ebe0631e5c Add dummy POST handling for whitelist and blacklist
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2017-08-08 23:08:54 -04:00