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 6fc9807 commit cea6067
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ transmit_thread(void *v) /*aka. scanning_thread() */
uint64_t *status_syn_count;
uint64_t entropy = masscan->seed;

LOG(1, "xmit: starting transmit thread #%u\n", parms->nic_index);
LOG(1, "THREAD: xmit: starting thread #%u\n", parms->nic_index);

/* export a pointer to this variable outside this threads so
* that the 'status' system can print the rate of syns we are
Expand Down Expand Up @@ -325,7 +325,7 @@ transmit_thread(void *v) /*aka. scanning_thread() */
/* -----------------
* the main loop
* -----------------*/
LOG(3, "xmit: starting main loop: [%llu..%llu]\n", start, end);
LOG(3, "THREAD: xmit: starting main loop: [%llu..%llu]\n", start, end);
for (i=start; i<end; ) {
uint64_t batch_size;

Expand Down Expand Up @@ -467,7 +467,7 @@ transmit_thread(void *v) /*aka. scanning_thread() */
/*
* Wait until the receive thread realizes the scan is over
*/
LOG(1, "Transmit thread done, waiting for receive thread to realize this\n");
LOG(1, "THREAD: xmit done, waiting for receive thread to realize this\n");
while (!is_tx_done)
pixie_usleep(1000);

Expand Down Expand Up @@ -506,7 +506,7 @@ transmit_thread(void *v) /*aka. scanning_thread() */

/* Thread is about to exit */
parms->done_transmitting = 1;
LOG(1, "xmit: stopping transmit thread #%u\n", parms->nic_index);
LOG(1, "THREAD: xmit: stopping thread #%u\n", parms->nic_index);
}


Expand Down Expand Up @@ -555,7 +555,7 @@ receive_thread(void *v)
*status_tcb_count = 0;
parms->total_tcbs = status_tcb_count;

LOG(1, "recv: start receive thread #%u\n", parms->nic_index);
LOG(1, "THREAD: recv: starting thread #%u\n", parms->nic_index);

/* Lock this thread to a CPU. Transmit threads are on even CPUs,
* receive threads on odd CPUs */
Expand Down Expand Up @@ -671,7 +671,7 @@ receive_thread(void *v)
* Receive packets. This is where we catch any responses and print
* them to the terminal.
*/
LOG(1, "begin receive thread\n");
LOG(1, "THREAD: recv: starting main loop\n");
while (!is_rx_done) {
int status;
unsigned length;
Expand Down Expand Up @@ -969,7 +969,7 @@ receive_thread(void *v)
}


LOG(1, "recv: end receive thread #%u\n", parms->nic_index);
LOG(1, "THREAD: recv: stopping thread #%u\n", parms->nic_index);

/*
* cleanup
Expand Down Expand Up @@ -1261,7 +1261,7 @@ main_scan(struct Masscan *masscan)
*/
status_start(&status);
status.is_infinite = masscan->is_infinite;
while (!is_tx_done) {
while (!is_tx_done && masscan->output.is_status_updates) {
unsigned i;
double rate = 0;
uint64_t total_tcbs = 0;
Expand Down Expand Up @@ -1321,6 +1321,7 @@ main_scan(struct Masscan *masscan)
/*
* Now wait for all threads to exit
*/
LOG(1, "THREAD: status: starting thread\n");
now = time(0);
for (;;) {
unsigned transmit_count = 0;
Expand Down Expand Up @@ -1367,7 +1368,7 @@ main_scan(struct Masscan *masscan)

}

pixie_mssleep(100);
pixie_mssleep(10);

if (transmit_count < masscan->nic_count)
continue;
Expand All @@ -1378,7 +1379,7 @@ main_scan(struct Masscan *masscan)
break;
}

LOG(1, "EXITING main thread\n");
LOG(1, "THREAD: status: stopping thread\n");

/*
* Now cleanup everything
Expand Down

0 comments on commit cea6067

Please sign in to comment.