google / gopacket

Provides packet processing capabilities for Go
BSD 3-Clause "New" or "Revised" License
6.22k stars 1.11k forks source link

TCP reassembly - connections remain in pool if no FIN was received? #592

Open omriyaacovi opened 5 years ago

omriyaacovi commented 5 years ago

https://github.com/google/gopacket/blob/a6b099ece4680a8bdea84fa78166d0712108a95c/reassembly/tcpassembly.go#L1271

This if statement is always issued before removing a connection from the pool. So if a specific connection didn't get a FIN or RST - it will remain in the pool even if I call FlushCloseOlderThan and the connection timed out?

secmobi commented 3 years ago

Just before this line of code, flushClose() is invoked for s2c and c2s respectively, which uses closeHalfConnection() to mark half.closed = true . Therefore I believe it's fine; and the problem you stated here doesn't exist.