mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-09-30 12:42:22 +07:00
master
If a TCP listening socket is externally destroyed (e.g., via ss -K, or a process using NETLINK_SOCK_DIAG/SOCK_DESTROY), accept() permanently returns -1 with errno == EINVAL because the socket is no longer in TCP_LISTEN state. Since poll() keeps reporting the stale fd as readable, the main loop spins calling do_tcp_connection() -> accept() indefinitely, consuming 100% CPU. Distinguish transient errors (EAGAIN, ECONNABORTED, EMFILE, ENFILE, ENOMEM, ENOBUFS) from fatal ones. On transient errors just return and retry on the next poll cycle. On fatal errors close the tcpfd and mark it -1 so poll() no longer selects it. In --bind-dynamic mode the listener will be automatically rebuilt on the next address change event via newaddress(). Signed-off-by: Yuefu Zhou <yuefu16.zhou@gmail.com>
…
…
…
…
Description
No description provided
12 MiB
Languages
C
94.3%
Perl
2.2%
HTML
1.2%
Shell
1%
Makefile
0.6%
Other
0.6%