Fix packet flags field not being cleared properly when the packet is being reused. Add some debug statements and cleanup some.

remotes/origin/master-1.0.x
Victor Julien 16 years ago
parent e2376948dd
commit a8116f65c8

@ -353,6 +353,8 @@ int AppLayerHandleMsg(StreamMsg *smsg, char need_lock)
r = AppLayerParse(smsg->flow, alproto, smsg->flags,
smsg->data.data, smsg->data.data_len, need_lock);
} else {
SCLogDebug("ALPROTO_UNKNOWN flow %p", smsg->flow);
}
} else {
SCLogDebug("stream data (len %" PRIu32 " (%" PRIu32 ")), alproto "

@ -27,7 +27,9 @@ void DecodeTunnel(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt
* \param p Packet to set the flag in
*/
inline void DecodeSetNoPayloadInspectionFlag(Packet *p) {
SCEnter();
p->flags |= PKT_NOPAYLOAD_INSPECTION;
SCReturn;
}
/** \brief Set the No packet inspection Flag for the packet.
@ -35,7 +37,9 @@ inline void DecodeSetNoPayloadInspectionFlag(Packet *p) {
* \param p Packet to set the flag in
*/
inline void DecodeSetNoPacketInspectionFlag(Packet *p) {
SCEnter();
p->flags |= PKT_NOPACKET_INSPECTION;
SCReturn;
}
void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv)

@ -352,6 +352,7 @@ typedef struct DecodeThreadVars_
(p)->dp = 0; \
(p)->flow = NULL; \
(p)->flowflags = 0; \
(p)->flags = 0; \
(p)->alerts.cnt = 0; \
PktHttpUriFree((p)); \
if ((p)->pktvar != NULL) { \

@ -76,7 +76,7 @@ Flow *FlowGetFlowFromHash (Packet *p)
FlowBucket *fb = &flow_hash[key];
SCMutexLock(&fb->m);
SCLogDebug("FlowGetFlowFromHash: fb %p fb->f %p", fb, fb->f);
SCLogDebug("fb %p fb->f %p", fb, fb->f);
/* see if the bucket already has a flow */
if (fb->f == NULL) {

@ -366,10 +366,14 @@ void FlowHandlePacket (ThreadVars *tv, Packet *p)
p->flowflags |= FLOW_PKT_TOSERVER_IPONLY_SET;
/*set the detection bypass flags*/
if (f->flags & FLOW_NOPACKET_INSPECTION)
if (f->flags & FLOW_NOPACKET_INSPECTION) {
SCLogDebug("setting FLOW_NOPACKET_INSPECTION flag on flow %p", f);
DecodeSetNoPacketInspectionFlag(p);
if (f->flags & FLOW_NOPAYLOAD_INSPECTION)
}
if (f->flags & FLOW_NOPAYLOAD_INSPECTION) {
SCLogDebug("setting FLOW_NOPAYLOAD_INSPECTION flag on flow %p", f);
DecodeSetNoPayloadInspectionFlag(p);
}
/* set the flow in the packet */
p->flow = f;
@ -785,9 +789,14 @@ int FlowSetProtoEmergencyTimeout(uint8_t proto, uint32_t emerg_new_timeout, uint
* \param f Flow to set the flag in
*/
void FlowLockSetNoPacketInspectionFlag(Flow *f) {
SCEnter();
SCLogDebug("flow %p", f);
SCMutexLock(&f->m);
f->flags |= FLOW_NOPACKET_INSPECTION;
SCMutexUnlock(&f->m);
SCReturn;
}
/** \brief Set the No Packet Inspection Flag without locking the flow.
@ -795,7 +804,12 @@ void FlowLockSetNoPacketInspectionFlag(Flow *f) {
* \param f Flow to set the flag in
*/
void FlowSetNoPacketInspectionFlag(Flow *f) {
SCEnter();
SCLogDebug("flow %p", f);
f->flags |= FLOW_NOPACKET_INSPECTION;
SCReturn;
}
/** \brief Set the No payload inspection Flag after locking the flow.
@ -803,9 +817,14 @@ void FlowSetNoPacketInspectionFlag(Flow *f) {
* \param f Flow to set the flag in
*/
void FlowLockSetNoPayloadInspectionFlag(Flow *f) {
SCEnter();
SCLogDebug("flow %p", f);
SCMutexLock(&f->m);
f->flags |= FLOW_NOPAYLOAD_INSPECTION;
SCMutexUnlock(&f->m);
SCReturn;
}
/** \brief Set the No payload inspection Flag without locking the flow.
@ -813,7 +832,12 @@ void FlowLockSetNoPayloadInspectionFlag(Flow *f) {
* \param f Flow to set the flag in
*/
void FlowSetNoPayloadInspectionFlag(Flow *f) {
SCEnter();
SCLogDebug("flow %p", f);
f->flags |= FLOW_NOPAYLOAD_INSPECTION;
SCReturn;
}
#ifdef UNITTESTS

@ -1468,7 +1468,7 @@ int StreamTcpReassembleHandleSegment(TcpReassemblyThreadCtx *ra_ctx,
Packet *p)
{
SCEnter();
SCLogDebug("ssn %p, stream %p, p %p, p->payload_len %"PRIu16"\n",
SCLogDebug("ssn %p, stream %p, p %p, p->payload_len %"PRIu16"",
ssn, stream, p, p->payload_len);
/* handle ack received */

Loading…
Cancel
Save