Avoid possiblity of potential engine idling from consumption of all packetpool packets - v1

- Now forced reassembly uses only malloced packets.
remotes/origin/master-1.1.x
Anoop Saldanha 14 years ago committed by Victor Julien
parent 7d3e501f57
commit 99207c718d

@ -85,6 +85,27 @@ Packet *PacketGetFromQueueOrAlloc(void) {
return p;
}
/**
* \brief Get a malloced packet.
*
* \retval p packet, NULL on error
*/
Packet *PacketGetFromAlloc(void)
{
Packet *p = SCMalloc(SIZE_OF_PACKET);
if (p == NULL) {
return NULL;
}
PACKET_INITIALIZE(p);
p->flags |= PKT_ALLOC;
SCLogDebug("allocated a new packet only using alloc...");
PACKET_PROFILING_START(p);
return p;
}
/**
* \brief Setup a pseudo packet (tunnel or reassembled frags)
*

@ -751,6 +751,7 @@ typedef struct DecodeThreadVars_
void DecodeRegisterPerfCounters(DecodeThreadVars *, ThreadVars *);
Packet *PacketPseudoPktSetup(Packet *parent, uint8_t *pkt, uint16_t len, uint8_t proto);
Packet *PacketGetFromQueueOrAlloc(void);
Packet *PacketGetFromAlloc(void);
int PacketCopyData(Packet *p, uint8_t *pktdata, int pktlen);
int PacketCopyDataOffset(Packet *p, int offset, uint8_t *data, int datalen);

@ -203,7 +203,7 @@ static uint64_t prune_usecnt = 0;
static inline Packet *FFRPseudoPacketSetup(int direction, Flow *f)
{
Packet *p = PacketGetFromQueueOrAlloc();
Packet *p = PacketGetFromAlloc();
if (p == NULL)
return NULL;
@ -359,12 +359,7 @@ static inline int FlowForceReassemblyForFlowV2(ThreadVars *tv, Flow *f)
SCSpinUnlock(&f->fb->s);
if (suricata_ctl_flags != 0) {
if (client_ok == 1) {
FlowDecrUsecnt(f);
}
if (server_ok == 1) {
FlowDecrUsecnt(f);
}
SCMutexUnlock(&f->m);
return 1;
}

Loading…
Cancel
Save