summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-06-18 12:43:06 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-06-18 12:43:06 +0000
commit04fa95b621e5c217f982a5593bf4f6695d6ce956 (patch)
tree4058f5a44f3c4583b31ffe7e95111375dc85fcac /src
parentAdding upstream version 2.1.1. (diff)
downloaddnscap-04fa95b621e5c217f982a5593bf4f6695d6ce956.tar.xz
dnscap-04fa95b621e5c217f982a5593bf4f6695d6ce956.zip
Adding upstream version 2.1.2.upstream/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;