Skip to content

Commit

Permalink
AFL instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdavidgraham committed Jun 6, 2016
1 parent edc4f47 commit 6fc9807
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/rawsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include <assert.h>
#include <ctype.h>

static int is_pcap_file = 0;

#ifdef WIN32
#include <Win32-Extensions.h>
#include <iphlpapi.h>
Expand Down Expand Up @@ -383,8 +385,14 @@ int rawsock_recv_packet(

*packet = pcap_next(adapter->pcap, &hdr);

if (*packet == NULL)
if (*packet == NULL) {
if (is_pcap_file) {
//pixie_time_set_offset(10*100000);
is_tx_done = 1;
is_rx_done = 1;
}
return 1;
}

*length = hdr.caplen;
*secs = hdr.ts.tv_sec;
Expand Down Expand Up @@ -734,6 +742,8 @@ rawsock_init_adapter(const char *adapter_name,

if (memcmp(adapter_name, "file:", 5) == 0) {
LOG(1, "pcap: file: %s\n", adapter_name+5);
is_pcap_file = 1;

adapter->pcap = pcap_open_offline(
adapter_name+5, /* interface name */
errbuf);
Expand Down

0 comments on commit 6fc9807

Please sign in to comment.