mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 13:30:31 +00:00
Kernel: Remove socket from the listener's accept list when it is closed
Without this patch we end up with sockets in the listener's accept queue with state 'closed' when doing stealth SYN scans: Client -> Server: SYN for port 22 Server -> Client: SYN/ACK Client -> Server: RST (i.e. don't complete the TCP handshake)
This commit is contained in:
parent
866e577f1d
commit
fb2ad94195
Notes:
sideshowbarker
2024-07-18 18:51:18 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/fb2ad941958 Pull-request: https://github.com/SerenityOS/serenity/pull/6762
1 changed files with 4 additions and 0 deletions
|
@ -40,6 +40,9 @@ void TCPSocket::set_state(State new_state)
|
|||
if (new_state == State::Closed) {
|
||||
Locker locker(closing_sockets().lock());
|
||||
closing_sockets().resource().remove(tuple());
|
||||
|
||||
if (m_originator)
|
||||
release_to_originator();
|
||||
}
|
||||
|
||||
if (previous_role != m_role || was_disconnected != protocol_is_disconnected())
|
||||
|
@ -114,6 +117,7 @@ void TCPSocket::release_to_originator()
|
|||
{
|
||||
VERIFY(!!m_originator);
|
||||
m_originator.strong_ref()->release_for_accept(this);
|
||||
m_originator.clear();
|
||||
}
|
||||
|
||||
void TCPSocket::release_for_accept(RefPtr<TCPSocket> socket)
|
||||
|
|
Loading…
Reference in a new issue