summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-06-18 12:43:12 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-06-18 12:43:12 +0000
commit1435ec536cf66a8835243a370da69418ac67915a (patch)
tree2412dd10d16e6e086a1aa9c894720cf47e362af4 /src
parentReleasing debian version 2.1.1-1. (diff)
downloaddnscap-1435ec536cf66a8835243a370da69418ac67915a.tar.xz
dnscap-1435ec536cf66a8835243a370da69418ac67915a.zip
Merging upstream version 2.1.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/tcpstate.c11
1 files changed, 9 insertions, 2 deletions
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;