summaryrefslogtreecommitdiff
path: root/trafgen_parser.y
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2016-12-15 18:00:04 +0100
committerTobias Klauser <tklauser@distanz.ch>2016-12-15 18:00:04 +0100
commitd6d511ecff241d459a70e270ac98d107faffdd45 (patch)
treef996436bd0b6c7d5b84966b7667d28a6cc31fecd /trafgen_parser.y
parent57739dfaa8bd88160fadcb34cea543c832a3b265 (diff)
trafgen: proto: Zero out newly allocated struct packet
When allocating a new struct packet, the headers and headers_count fields are not zeroed and retain whatever value the allocator returned. Incidentally, this usually seems to have been zero. But on some systems (e.g. Ubuntu 16.04 with a self-compiled 4.9) it is not and we hit the following bug_on: trafgen: trafgen_proto.c:135: proto_header_push: Assertion `!(pkt->headers_count >= 16)' failed. Fix this by properly zeroing the entire struct packet. Fixes: e7dd63060e44 ("trafgen: proto: Update field value at runtime") Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'trafgen_parser.y')
-rw-r--r--trafgen_parser.y3
1 files changed, 1 insertions, 2 deletions
diff --git a/trafgen_parser.y b/trafgen_parser.y
index 54aafe7..2340fd4 100644
--- a/trafgen_parser.y
+++ b/trafgen_parser.y
@@ -117,8 +117,7 @@ static inline void __init_new_packet_slot(struct packet *slot)
static inline void __init_new_counter_slot(struct packet_dyn *slot)
{
- slot->cnt = NULL;
- slot->clen = 0;
+ memset(slot, 0, sizeof(*slot);
}
static inline void __init_new_randomizer_slot(struct packet_dyn *slot)