-
-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Major rewrite of the socket processing routines #1396
Conversation
Signed-off-by: DL6ER <[email protected]>
…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 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is istelnet
missing in /api/reques.c
for all messages >cacheinfo
up to >interfaces
The Unix socket interface was introduced after the Telnet was already present. It was supposed to become the interface between FTL and the at that time drafted (and now abandoned) HTTP API written in another language. As the Telnet-like replying using ASCII-encoded numbers is pretty inefficient for machine-machine communication, we implemented After it got clear that the HTTP API isn't going to make it, we abandoned the development of the Unix socket part and new API endpoints did not get a different output than "ordinary" Telnet requests (this is the answer to your qeustion). We could (and maybe should) have removed the Unix socket sometime in between as I'm not sure anyone on this planet is actually using it. However, we still have it. All this code is removed for |
Maybe this PR is a good place to remove all fragments of the Unix socket? |
My self-assignment isn't a blocker for merge. |
By submitting this pull request, I confirm the following:
How familiar are you with the codebase?:
10
Major rewrite of the socket processing routines of FTL's Telnet-like API.
Before, we launched a new thread for each incoming connection (more than 40 threads concurrent were never allowed) to handle incoming connections independent from another and serve content concurrently. However, 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 (independent for telnet over IPv4, IPv6, and Unix socket communication = 15 threads in total). Each of them accepts incoming connections in a FIFO manner (they always pick the first connection in the waiting connection queue). If too many requests are sent to FTL at once, they will simply be queued by the system until FTL is ready to accept them.
This is meant as a bugfix related to pi-hole/PADD#252,