diff --git a/src/decode.c b/src/decode.c index 3ee08b0ade..7aa4fdd918 100644 --- a/src/decode.c +++ b/src/decode.c @@ -22,3 +22,19 @@ void DecodeTunnel(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt } } +/** \brief Set the No payload inspection Flag for the packet. + * + * \param p Packet to set the flag in + */ +void DecodeSetNoPayloadInspectionFlag(Packet *p) { + p->flags |= PKT_NOPAYLOAD_INSPECTION; +} + +/** \brief Set the No packet inspection Flag for the packet. + * + * \param p Packet to set the flag in + */ +void DecodeSetNoPacketInspectionFlag(Packet *p) { + p->flags |= PKT_NOPACKET_INSPECTION; +} + diff --git a/src/decode.h b/src/decode.h index 8ba7cdc5bc..f8fd035bd5 100644 --- a/src/decode.h +++ b/src/decode.h @@ -425,6 +425,9 @@ void DecodeGRE(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, Packet *SetupPkt (void); Packet *TunnelPktSetup(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, uint16_t, uint8_t); +void DecodeSetNoPayloadInspectionFlag(Packet *); +void DecodeSetNoPacketInspectionFlag(Packet *); + #define DECODER_SET_EVENT(p, e) ((p)->events[(e/8)] |= (1<<(e%8))) #define DECODER_ISSET_EVENT(p, e) ((p)->events[(e/8)] & (1<<(e%8))) @@ -459,5 +462,9 @@ Packet *TunnelPktSetup(ThreadVars *, DecodeThreadVars *, Packet *, uint8_t *, ui #define PPP_OVER_GRE 11 +/*Packet Flags*/ +#define PKT_NOPACKET_INSPECTION 0x01 /**< Flag to indicate that packet header or contents should not be inspected*/ +#define PKT_NOPAYLOAD_INSPECTION 0x02 /**< Flag to indicate that packet contents should not be inspected*/ + #endif /* __DECODE_H__ */ diff --git a/src/flow-private.h b/src/flow-private.h index a4bb1aa622..81883f357a 100644 --- a/src/flow-private.h +++ b/src/flow-private.h @@ -17,8 +17,8 @@ #define FLOW_TOSERVER_IPONLY_SET 0x0020 #define FLOW_TOCLIENT_IPONLY_SET 0x0040 -#define FLOW_NOPACKET_INSPECTION 0x0080 -#define FLOW_NOPAYLOAD_INSPECTION 0x0100 +#define FLOW_NOPACKET_INSPECTION 0x0080 /**< Flag to indicate the packet belongs to this flow should not be inspected*/ +#define FLOW_NOPAYLOAD_INSPECTION 0x0100 /**< Flag to indicate the contents or the packet which belongs to this flow should not be inspected*/ /* global flow flags */ #define FLOW_EMERGENCY 0x01 diff --git a/src/flow.c b/src/flow.c index cda3cdc286..6127d2849d 100644 --- a/src/flow.c +++ b/src/flow.c @@ -345,9 +345,9 @@ void FlowHandlePacket (ThreadVars *tv, Packet *p) /*set the detection bypass flags*/ if (f->flags & FLOW_NOPACKET_INSPECTION) - FlowSetPktNoPacketInspectionFlag(p); + DecodeSetNoPacketInspectionFlag(p); if (f->flags & FLOW_NOPAYLOAD_INSPECTION) - FlowSetPktNoPayloadInspectionFlag(p); + DecodeSetNoPayloadInspectionFlag(p); /* set the flow in the packet */ p->flow = f; @@ -750,8 +750,8 @@ int FlowSetProtoEmergencyTimeout(uint8_t proto, uint32_t emerg_new_timeout, uint /** \brief Set the No Packet Inspection Flag after locking the flow. * - * \param f Flow to set the flag in - */ + * \param f Flow to set the flag in + */ void FlowLockSetNoPacketInspectionFlag(Flow *f) { mutex_lock(&f->m); f->flags |= FLOW_NOPACKET_INSPECTION; @@ -760,16 +760,16 @@ void FlowLockSetNoPacketInspectionFlag(Flow *f) { /** \brief Set the No Packet Inspection Flag without locking the flow. * - * \param f Flow to set the flag in - */ + * \param f Flow to set the flag in + */ void FlowSetNoPacketInspectionFlag(Flow *f) { f->flags |= FLOW_NOPACKET_INSPECTION; } /** \brief Set the No payload inspection Flag after locking the flow. * - * \param f Flow to set the flag in - */ + * \param f Flow to set the flag in + */ void FlowLockSetNoPayloadInspectionFlag(Flow *f) { mutex_lock(&f->m); f->flags |= FLOW_NOPAYLOAD_INSPECTION; @@ -778,28 +778,12 @@ void FlowLockSetNoPayloadInspectionFlag(Flow *f) { /** \brief Set the No payload inspection Flag without locking the flow. * - * \param f Flow to set the flag in - */ + * \param f Flow to set the flag in + */ void FlowSetNoPayloadInspectionFlag(Flow *f) { f->flags |= FLOW_NOPAYLOAD_INSPECTION; } -/** \brief Set the No payload inspection Flag for the packet. - * - * \param p Packet to set the flag in - */ -void FlowSetPktNoPayloadInspectionFlag(Packet *p) { - p->flags |= PKT_NOPAYLOAD_INSPECTION; -} - -/** \brief Set the No packet inspection Flag for the packet. - * - * \param p Packet to set the flag in - */ -void FlowSetPktNoPacketInspectionFlag(Packet *p) { - p->flags |= PKT_NOPACKET_INSPECTION; -} - #ifdef UNITTESTS #include "stream-tcp-private.h" diff --git a/src/flow.h b/src/flow.h index caf44600a5..c491210262 100644 --- a/src/flow.h +++ b/src/flow.h @@ -19,10 +19,6 @@ #define FLOW_PKT_NOSTREAM 0x40 #define FLOW_PKT_STREAMONLY 0x80 -/*Packet Flags*/ -#define PKT_NOPACKET_INSPECTION 0x01 -#define PKT_NOPAYLOAD_INSPECTION 0x02 - /* global flow config */ typedef struct FlowCnf_ { @@ -127,6 +123,10 @@ int FlowSetProtoEmergencyTimeout(uint8_t ,uint32_t ,uint32_t ,uint32_t); int FlowSetProtoFreeFunc (uint8_t , void (*Free)(void *)); int FlowSetFlowStateFunc (uint8_t , int (*GetProtoState)(void *)); void FlowUpdateQueue(Flow *); +void FlowLockSetNoPacketInspectionFlag(Flow *); +void FlowSetNoPacketInspectionFlag(Flow *); +void FlowLockSetNoPayloadInspectionFlag(Flow *); +void FlowSetNoPayloadInspectionFlag(Flow *); #endif /* __FLOW_H__ */ diff --git a/src/stream-tcp-private.h b/src/stream-tcp-private.h index ce42181b30..d15ea90cd8 100644 --- a/src/stream-tcp-private.h +++ b/src/stream-tcp-private.h @@ -57,7 +57,7 @@ enum #define STREAMTCP_FLAG_NOSERVER_REASSEMBLY 0x40 /**< Flag to avoid stream reassembly / application layer inspection for the server stream.*/ -#define PAWS_24DAYS 2073600 /* 24 days in seconds */ +#define PAWS_24DAYS 2073600 /**< 24 days in seconds */ /* Macro's for comparing Sequence numbers * Page 810 from TCP/IP Illustrated, Volume 2. */