Skip to content

Commit

Permalink
undo not adding session if its not a SYN packet, so we get correct RS…
Browse files Browse the repository at this point in the history
…T response
  • Loading branch information
compscidr committed Nov 7, 2024
1 parent e5a177d commit ecff78c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/main/kotlin/com/jasonernst/kanonproxy/KAnonProxy.kt
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,14 @@ class KAnonProxy(
transportHeader.destinationPort,
ipHeader.protocol,
)
if (!sessionTableBySessionKey.containsKey(key)) {
if (transportHeader is TcpHeader) {
if (transportHeader.isSyn().not()) {
logger.warn("non-syn packet for new session: {}, ignoring", key)
return
}
}
}
// if (!sessionTableBySessionKey.containsKey(key)) {
// if (transportHeader is TcpHeader) {
// if (transportHeader.isSyn().not()) {
// logger.warn("non-syn packet for new session: {}, ignoring", key)
// return
// }
// }
// }
val session =
sessionTableBySessionKey.getOrPut(key) {
isNewSession = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import java.net.SocketException
import java.nio.ByteBuffer

// this needs to be set to 250 if we want to test the TIME_WAIT state
@Timeout(60)
@Timeout(20)
class TcpHandlingTest {
private val logger = LoggerFactory.getLogger(javaClass)
private val kAnonProxy = KAnonProxy(IcmpLinux, mockk(relaxed = true))
Expand Down

0 comments on commit ecff78c

Please sign in to comment.