mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:22:45 +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
					
				
					 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…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Gunnar Beutner
						Gunnar Beutner