Clean the whole thing after use.
} ICMPV4Vars;
#define CLEAR_ICMPV4_PACKET(p) do { \
- (p)->level4_comp_csum = -1; \
- (p)->icmpv4vars.id = 0; \
- (p)->icmpv4vars.seq = 0; \
- (p)->icmpv4vars.emb_ipv4h = NULL; \
- (p)->icmpv4vars.emb_tcph = NULL; \
- (p)->icmpv4vars.emb_udph = NULL; \
- (p)->icmpv4vars.emb_icmpv4h = NULL; \
- (p)->icmpv4vars.emb_ip4_src.s_addr = 0; \
- (p)->icmpv4vars.emb_ip4_dst.s_addr = 0; \
- (p)->icmpv4vars.emb_sport = 0; \
- (p)->icmpv4vars.emb_ip4_proto = 0; \
- (p)->icmpv4vars.emb_sport = 0; \
- (p)->icmpv4vars.emb_dport = 0; \
- (p)->icmpv4h = NULL; \
+ (p)->level4_comp_csum = -1; \
+ PACKET_CLEAR_L4VARS((p)); \
+ (p)->icmpv4h = NULL; \
} while(0)
#define ICMPV4_HEADER_PKT_OFFSET 8
#define CLEAR_ICMPV6_PACKET(p) do { \
- (p)->level4_comp_csum = -1; \
- (p)->icmpv6vars.id = 0; \
- (p)->icmpv6vars.seq = 0; \
- (p)->icmpv6vars.mtu = 0; \
- (p)->icmpv6vars.error_ptr = 0; \
- (p)->icmpv6vars.emb_ipv6h = NULL; \
- (p)->icmpv6vars.emb_tcph = NULL; \
- (p)->icmpv6vars.emb_udph = NULL; \
- (p)->icmpv6vars.emb_icmpv6h = NULL; \
- (p)->icmpv6vars.emb_ip6_src[0] = 0; \
- (p)->icmpv6vars.emb_ip6_src[1] = 0; \
- (p)->icmpv6vars.emb_ip6_src[2] = 0; \
- (p)->icmpv6vars.emb_ip6_src[3] = 0; \
- (p)->icmpv6vars.emb_ip6_proto_next = 0; \
- (p)->icmpv6vars.emb_sport = 0; \
- (p)->icmpv6vars.emb_dport = 0; \
- (p)->icmpv6h = NULL; \
+ (p)->level4_comp_csum = -1; \
+ PACKET_CLEAR_L4VARS((p)); \
+ (p)->icmpv6h = NULL; \
} while(0)
void DecodeICMPV6RegisterTests(void);
TCPOpt mss;
} TCPVars;
-#define CLEAR_TCP_PACKET(p) { \
- (p)->tcph = NULL; \
+#define CLEAR_TCP_PACKET(p) { \
(p)->level4_comp_csum = -1; \
- (p)->tcpvars.ts_set = FALSE; \
- (p)->tcpvars.ts_val = 0; \
- (p)->tcpvars.ts_ecr = 0; \
- (p)->tcpvars.sack.type = 0; \
- (p)->tcpvars.sackok.type = 0; \
- (p)->tcpvars.ws.type = 0; \
- (p)->tcpvars.mss.type = 0; \
+ PACKET_CLEAR_L4VARS((p)); \
+ (p)->tcph = NULL; \
}
void DecodeTCPRegisterTests(void);
UDPVars udpvars;
ICMPV4Vars icmpv4vars;
ICMPV6Vars icmpv6vars;
- };
+ } l4vars;
+#define tcpvars l4vars.tcpvars
+#define udpvars l4vars.udpvars
+#define icmpv4vars l4vars.icmpv4vars
+#define icmpv6vars l4vars.icmpv6vars
TCPHdr *tcph;
void CaptureStatsUpdate(ThreadVars *tv, CaptureStats *s, const Packet *p);
void CaptureStatsSetup(ThreadVars *tv, CaptureStats *s);
+#define PACKET_CLEAR_L4VARS(p) do { \
+ memset(&(p)->l4vars, 0x00, sizeof((p)->l4vars)); \
+ } while (0)
+
/**
* \brief reset these to -1(indicates that the packet is fresh from the queue)
*/