From dd3f68575a92385f0bb83af3809fb6b07c7a97a0 Mon Sep 17 00:00:00 2001 From: Emmanuel Roullit Date: Wed, 2 Jun 2010 06:07:00 +0000 Subject: [PATCH] First shot fixing Issue 14 git-svn-id: http://netsniff-ng.googlecode.com/svn/trunk@389 21e0ff64-9a0b-11de-825e-994487f65616 --- netsniff-ng/include/netsniff-ng/packet.h | 2 ++ netsniff-ng/lib/print.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/netsniff-ng/include/netsniff-ng/packet.h b/netsniff-ng/include/netsniff-ng/packet.h index 446b6ead..03b8f39b 100644 --- a/netsniff-ng/include/netsniff-ng/packet.h +++ b/netsniff-ng/include/netsniff-ng/packet.h @@ -61,6 +61,8 @@ static inline int parse_packet(uint8_t * raw, uint32_t len, packet_t * pkt) uint32_t tmp_len = len; uint16_t l4_type = 0; + memset(pkt, 0, sizeof(*pkt)); + pkt->raw = raw; pkt->ethernet_header = get_ethhdr(buffer, &tmp_len); set_pkt_step(pkt, ETHERNET); diff --git a/netsniff-ng/lib/print.c b/netsniff-ng/lib/print.c index 31e38c12..625842a6 100644 --- a/netsniff-ng/lib/print.c +++ b/netsniff-ng/lib/print.c @@ -123,8 +123,6 @@ void reduced_print(ring_buff_bytes_t * rbb, const struct tpacket_hdr *tp) { uint16_t l4_type = 0; packet_t pkt; - - memset(&pkt, 0, sizeof(pkt)); parse_packet(rbb, tp->tp_len, &pkt); @@ -301,8 +299,6 @@ static inline void __versatile_header_only_print(ring_buff_bytes_t * rbb, const assert(tp); assert(pkt); - memset(pkt, 0, sizeof(*pkt)); - parse_packet(rbb, tp->tp_len, pkt); info("%d Byte, Timestamp (%u.%u s) \n", tp->tp_len, tp->tp_sec, tp->tp_usec); -- 2.11.4.GIT