Commit 6fc98075 authored by robertdavidgraham's avatar robertdavidgraham
Browse files

AFL instrumentation

parent edc4f47a
Loading
Loading
Loading
Loading
+11 −1
Changes for src/rawsock.c: 11 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -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>
@@ -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;
@@ -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);