Commit Graph
40 Commits
Author SHA1 Message Date
DL6ER 1e39eddbf8 Ensure DELAY_STARTUP can be interrupted by external signals (e.g. SIGTERM) when trying to restart FTL really early
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-11-03 20:45:31 +01:00
Christian König 597e98e773 Don't create FTL.port
Signed-off-by: Christian König <ckoenig@posteo.de>
2022-09-21 12:06:14 +02:00
DL6ER a36a0eec7b Merge pull request #1411 from pi-hole/master
sync: master to development
2022-08-21 08:46:43 +02:00
DL6ER a709818764 Fix storing of API thread IDs
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-08-20 15:01:03 +02:00
DL6ER b92126fd6f Major rewrite of the socket processing routines. Before, we launched a new thread for each incoming connection (more than 40 threads were never allowed). This could potentially be used to DoS FTL by opening and closing telnet sessions in very quick succession. The new behavior is to, instead, launch five (compile-time setting) threads per type (5 for telnet IPv4, 5 for telnet IPv6, and 5 for Unix socket communication) and let them handle incoming connections in a FIFO manner. If too many requests are sent to FTL at once, they will simply have to wait until they are accepted.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-08-17 21:36:13 +01:00
DL6ER d8ce2e826b Ensure errno value is restored on return of syscall functions.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-08-17 21:36:06 +01:00
DL6ER 3ecb14640c Major rewrite of the socket processing routines. Before, we launched a new thread for each incoming connection (more than 40 threads were never allowed). This could potentially be used to DoS FTL by opening and closing telnet sessions in very quick succession. The new behavior is to, instead, launch five (compile-time setting) threads per type (5 for telnet IPv4, 5 for telnet IPv6, and 5 for Unix socket communication) and let them handle incoming connections in a FIFO manner. If too many requests are sent to FTL at once, they will simply have to wait until they are accepted.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-07-30 18:34:43 +02:00
DL6ER 5a095b1cb1 Ensure errno value is restored on return of syscall functions.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-07-30 13:53:32 +02:00
DL6ER 43917f017d Revert "Remove PID and PORT file during shutdown" 2022-07-10 15:01:24 +02:00
yubiuser 9021578666 Merge pull request #1349 from pi-hole/tweak/delay_uptime
DELAY_STARTUP only when booting
2022-06-12 16:31:39 +02:00
yubiuser d75978b0a5 Merge pull request #1328 from pi-hole/tweak/removePIDfile
Remove PID and PORT file during shutdown
2022-06-06 17:55:12 +02:00
DL6ERandyubiuser 61ed28e41b Apply suggestions from code review
Co-authored-by: yubiuser <ckoenig@posteo.de>
2022-05-19 22:42:16 +02:00
DL6ER eca9c7ddab Apply DELAY_STARTUP only when the system is still booting. The amount of time we consider a system still booting is a compile-time constant. It defaults to 60 seconds.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-05-19 08:32:00 +02:00
Adam Warner 671a438c4d Fix some spellings, ignore others
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2022-04-22 18:26:31 +01:00
DL6ER 7dd0d5837b Remove PID file during shutdown
Signed-off-by: DL6ER <dl6er@dl6er.de>
2022-04-18 10:01:59 +02:00
DL6ER 028989bcae Reduce code duplication by using labels + ensure we do not run dbclose() multiple times on database issues (e.g., when database is locked)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-11-14 13:01:39 +01:00
DL6ER ac0346b9e2 Improvements based on static-analysis of source code
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-09-23 20:24:57 +02:00
DL6ER 07da984a96 Improvements suggested by cppcheck
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-09-07 21:36:21 +02:00
DL6ER f164e81e47 Ensure API threads can be canceled asynchronously
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-06-24 12:02:46 +02:00
DL6ER 85a22e7485 Also cancel other threads when terminating
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-06-24 12:02:45 +02:00
DL6ER 61d82aab1c Merge branch 'development' into new/reply_pihole_hostname
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-06-23 20:27:29 +02:00
DL6ER ada54a7274 Add location logging to no-lock message
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-05-10 17:36:20 +02:00
DL6ER 1ad6f5b6c4 Don't try to terminate threads when we never launched them.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-04-19 21:35:37 +02:00
DL6ER f72962c1f6 Give threads a bit more time to reach a point where cancellation is safe. We cannot give them too much time because, otherwise, the proces trying to TERMinate FTL may decide to KILL it instead. We should avoid this to be able to properly cleanup.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-04-18 11:09:52 +02:00
DL6ER e870f7a36a FTL automatically replies with the appropriate IP address to both p.hole and the machine's hostname. The replied with IP address can be overwritten using the REPLY_ADDR4/6 setting.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-04-16 11:31:59 +02:00
DL6ER 0795cf6209 Open individual database connections where we need them. Do not use global pointers anywhere. This may mean we have more than one connection open at the sae time. SQLite3 will take care of thread-safety.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-03-20 20:21:09 +00:00
DL6ER e6fe87853a Add timeout to joining of threads
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-03-20 06:33:17 +00:00
DL6ER 6a9566c6ab Ensure we close FTL database connection when exiting the main process. This has no consequences else than silencing some meomry-lost complaints by valgrind (any allocated memory is release on process exit anyway)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-03-16 13:46:28 +01:00
DL6ER 981a9d1a6e Join canceled threads on exit to ensure they exited properly before we exit from the main process. This includes waiting for them to clean up their own stack memory, etc.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-03-16 13:42:49 +01:00
DL6ER 70ee90ebfc Clean up after dnsmasq errors (port not available config errors, etc.)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-02-17 13:44:31 +01:00
DL6ER 8244043ca1 Terminate threads before closing database connections and finishing shared memory
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-02-17 13:02:18 +01:00
DL6ER b6fe3379b0 Also clean up when crashing
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-02-17 11:50:32 +01:00
DL6ER b475e5be1f Ensure we clean up always behind us. Also when FTL crashes
Signed-off-by: DL6ER <dl6er@dl6er.de>
2021-02-17 11:46:36 +01:00
DL6ER 7459d8235b Rename memory.c -> syscalls.c
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-12-09 20:21:03 +01:00
DL6ER 52af8e135b Merge branch 'release/v5.2' into new/mac_clients
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-07-29 12:21:12 +02:00
DL6ER b89a6be680 Improve logging for forks and thread by including further details to the log ID
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-06-26 09:49:57 +02:00
DL6ER 43124f71e6 Try to resolve empty host names in the network_addresses table when re-resolving host names (typically once per hour). Do this only for fairly recent IP addresses (hard-coded 24h as we're speaking) to avoid unnecessary noice leading to inaccurate data.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-18 22:56:55 +02:00
DL6ER 48186a6862 Add DELAY_STARTUP setting to delay startup of the embedded dnsmasq.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-03-25 10:09:14 +01:00
DL6ER e13e39ad42 Union FTLFileNamesStruct and logFileNamesStruct and define them in config{.c/.h}
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-07-05 16:36:06 +02:00
DL6ER e365364f72 Move all source files into new subdirectory "src". Put compiled objects into new subdirectory "build".
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-07-02 00:18:56 +02:00