]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
flow-timeout: use packet pool 1272/head
authorVictor Julien <victor@inliniac.net>
Wed, 17 Dec 2014 16:15:38 +0000 (17:15 +0100)
committerVictor Julien <victor@inliniac.net>
Fri, 19 Dec 2014 11:18:28 +0000 (12:18 +0100)
Use packet pool for pseudo packets on flow timeout. Wait for a packet
if necessary.

For shutdown, alloc a new pool as the 'main()' thread calls this.

src/flow-timeout.c

index 36391783f0c7c886bc7dcd2d5445f74f5e5ef0b3..a3de51da6444d17534efda4dfa9d27eca62f23eb 100644 (file)
@@ -238,11 +238,13 @@ static inline Packet *FlowForceReassemblyPseudoPacketGet(int direction,
                                                          TcpSession *ssn,
                                                          int dummy)
 {
-    Packet *p;
-
-    p = PacketGetFromAlloc();
-    if (p == NULL)
+    PacketPoolWait();
+    Packet *p = PacketPoolGetPacket();
+    if (p == NULL) {
         return NULL;
+    }
+
+    PACKET_PROFILING_START(p);
 
     return FlowForceReassemblyPseudoPacketSetup(p, direction, f, ssn, dummy);
 }
@@ -535,9 +537,11 @@ static inline void FlowForceReassemblyForHash(void)
  */
 void FlowForceReassembly(void)
 {
+    /* called by 'main()' which has no packet pool */
+    PacketPoolInit();
     /* Carry out flow reassembly for unattended flows */
     FlowForceReassemblyForHash();
-
+    PacketPoolDestroy();
     return;
 }