From c306e562c132efd5129c8e94b2910bce45ef92b1 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Sun, 30 May 2010 13:18:34 +0000 Subject: [PATCH] Fixed broken read mode. Assertion failed at bootstrap exit (when restoring nic flags). git-svn-id: http://netsniff-ng.googlecode.com/svn/trunk@388 21e0ff64-9a0b-11de-825e-994487f65616 --- netsniff-ng/lib/bootstrap.c | 3 +++ netsniff-ng/lib/replay.c | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/netsniff-ng/lib/bootstrap.c b/netsniff-ng/lib/bootstrap.c index 6e40203e..b639fd75 100644 --- a/netsniff-ng/lib/bootstrap.c +++ b/netsniff-ng/lib/bootstrap.c @@ -455,6 +455,9 @@ static void __exit_stage_mode_common(system_data_t * sd, int *sock, ring_buff_t assert(sd); assert(sock); assert(rb); + + if (sd->mode == MODE_READ) + return; if(sd->promisc_mode != PROMISC_MODE_NONE) { /* Restore flags which were set at program start */ diff --git a/netsniff-ng/lib/replay.c b/netsniff-ng/lib/replay.c index b3809ca0..da53a4a8 100644 --- a/netsniff-ng/lib/replay.c +++ b/netsniff-ng/lib/replay.c @@ -74,8 +74,6 @@ int pcap_validate_header(int fd) { struct pcap_file_header hdr; - printf("validate pcap\n"); - if (fd < 0) { warn("Can't open file.\n"); exit(EXIT_FAILURE); @@ -110,9 +108,9 @@ size_t pcap_fetch_next_packet(int fd, struct tpacket_hdr *tp_h, struct ethhdr *s } if (read(fd, (char *)&sf_hdr, sizeof(sf_hdr)) != sizeof(sf_hdr)) { - err("Cannot read packet header"); return(0); } + //calc offset ? //tp_h->tp_sec = sf_hdr.ts.tv_sec; //tp_h->tp_usec = sf_hdr.ts.tv_usec; @@ -120,7 +118,6 @@ size_t pcap_fetch_next_packet(int fd, struct tpacket_hdr *tp_h, struct ethhdr *s tp_h->tp_len = sf_hdr.len; if (read(fd, (char *)sp, sf_hdr.len) != sf_hdr.len) { - info("Reached end of pcap"); return(0); } -- 2.11.4.GIT