Convert Packet tunnel variables to bit flag checks.

remotes/origin/master-1.1.x
Victor Julien 15 years ago
parent 75439863ed
commit 3d22713b09

@ -388,9 +388,6 @@ typedef struct Packet_
SCMutex mutex_rtv_cnt;
/* tunnel stuff */
uint8_t tunnel_proto;
/* tunnel XXX convert to bitfield*/
char tunnel_pkt;
char tunnel_verdicted;
/* decoder events */
PacketDecoderEvents events;
@ -586,8 +583,6 @@ typedef struct DecodeThreadVars_
SCMutexDestroy(&(p)->mutex_rtv_cnt); \
SCMutexInit(&(p)->mutex_rtv_cnt, NULL); \
(p)->tunnel_proto = 0; \
(p)->tunnel_pkt = 0; \
(p)->tunnel_verdicted = 0; \
(p)->events.cnt = 0; \
(p)->next = NULL; \
(p)->prev = NULL; \
@ -700,9 +695,13 @@ typedef struct DecodeThreadVars_
#define TUNNEL_PKT_RTV(p) ((p)->root ? (p)->root->rtv_cnt : (p)->rtv_cnt)
#define TUNNEL_PKT_TPR(p) ((p)->root ? (p)->root->tpr_cnt : (p)->tpr_cnt)
#define IS_TUNNEL_ROOT_PKT(p) (((p)->root == NULL && (p)->tunnel_pkt == 1))
#define IS_TUNNEL_PKT(p) (((p)->tunnel_pkt == 1))
#define SET_TUNNEL_PKT(p) ((p)->tunnel_pkt = 1)
//#define IS_TUNNEL_ROOT_PKT(p) (((p)->root == NULL && (p)->tunnel_pkt == 1))
#define IS_TUNNEL_PKT(p) (((p)->flags & PKT_TUNNEL))
#define SET_TUNNEL_PKT(p) ((p)->flags |= PKT_TUNNEL)
#define IS_TUNNEL_ROOT_PKT(p) (IS_TUNNEL_PKT(p) && (p)->root == NULL)
#define IS_TUNNEL_PKT_VERDICTED(p) (((p)->flags & PKT_TUNNEL_VERDICTED))
#define SET_TUNNEL_PKT_VERDICTED(p) ((p)->flags |= PKT_TUNNEL_VERDICTED)
void DecodeRegisterPerfCounters(DecodeThreadVars *, ThreadVars *);
@ -822,6 +821,9 @@ void AddressDebugPrint(Address *);
#define PKT_MARK_MODIFIED 0x0400 /**< Packet mark is modified */
#define PKT_STREAM_NOPCAPLOG 0x0800 /**< Exclude packet from pcap logging as it's part of a stream that has reassembly depth reached. */
#define PKT_TUNNEL 0x1000
#define PKT_TUNNEL_VERDICTED 0x2000
/** \brief return 1 if the packet is a pseudo packet */
#define PKT_IS_PSEUDOPKT(p) ((p)->flags & PKT_PSEUDO_STREAM_END)

@ -157,7 +157,7 @@ void TmqhOutputPacketpool(ThreadVars *t, Packet *p)
* packets, don't add this. It's still referenced
* by the tunnel packets, and we will enqueue it
* when we handle them */
p->tunnel_verdicted = 1;
SET_TUNNEL_PKT_VERDICTED(p);
SCMutexUnlock(m);
SCReturn;
}
@ -169,7 +169,7 @@ void TmqhOutputPacketpool(ThreadVars *t, Packet *p)
* p->root == NULL. So when we are here p->root can only be
* non-NULL, right? CLANG thinks differently. May be a FP, but
* better safe than sorry. VJ */
if (p->root != NULL && p->root->tunnel_verdicted == 1 &&
if (p->root != NULL && IS_TUNNEL_PKT_VERDICTED(p->root) &&
TUNNEL_PKT_TPR(p) == 1)
{
SCLogDebug("p->root->tunnel_verdicted == 1 && TUNNEL_PKT_TPR(p) == 1");

Loading…
Cancel
Save