mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
77476580eda8246d3968583e2ae7c97523637b95
When dnsmasq forks a child to handle a TCP connection, that child inherits the netlink socket that the main process has open. The child never uses that socket, but there's a chance that when the main process uses the netlink socket, the answer will go to a child process which has a copy of the socket. This causes the main process to block forever awaiting the answer which never comes. The solution is for the child process to close the netlink socket it inherits after the fork(). There's a nasty race because the error decribed above could still occur in the window between the fork() and the close() syscalls. That's fixed by blocking the parent awaiting a single byte sent though the pipe the two processes share. This byte is sent by the child after calling close() on the netlink socket. Thanks to Alin Năstac for spotting this.
Description
No description provided
Languages
C
94.2%
Perl
2.3%
HTML
1.2%
Shell
1.1%
Makefile
0.6%
Other
0.6%