From 1435ec536cf66a8835243a370da69418ac67915a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 18 Jun 2023 14:43:12 +0200 Subject: Merging upstream version 2.1.2. Signed-off-by: Daniel Baumann --- src/tcpstate.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/tcpstate.c') diff --git a/src/tcpstate.c b/src/tcpstate.c index fce5ba1..5bc3840 100644 --- a/src/tcpstate.c +++ b/src/tcpstate.c @@ -77,6 +77,8 @@ tcpstate_ptr tcpstate_find(iaddr from, iaddr to, unsigned sport, unsigned dport, return tcpstate; } +tcpstate_ptr _curr_tcpstate = 0; + tcpstate_ptr tcpstate_new(iaddr from, iaddr to, unsigned sport, unsigned dport) { tcpstate_ptr tcpstate = calloc(1, sizeof *tcpstate); @@ -87,6 +89,13 @@ tcpstate_ptr tcpstate_new(iaddr from, iaddr to, unsigned sport, unsigned dport) tcpstate = TAIL(tcpstates); assert(tcpstate != NULL); UNLINK(tcpstates, tcpstate, link); + if (tcpstate->reasm) { + tcpreasm_free(tcpstate->reasm); + } + if (_curr_tcpstate == tcpstate) { + _curr_tcpstate = 0; + } + memset(tcpstate, 0, sizeof(*tcpstate)); } else { tcpstate_count++; } @@ -99,8 +108,6 @@ tcpstate_ptr tcpstate_new(iaddr from, iaddr to, unsigned sport, unsigned dport) return tcpstate; } -tcpstate_ptr _curr_tcpstate = 0; - tcpstate_ptr tcpstate_getcurr(void) { return _curr_tcpstate; -- cgit v1.2.3