Commit 676635df authored by robertdavidgraham's avatar robertdavidgraham
Browse files

added 'is_' prefix to boolean variables

parent 8f42c8a4
Loading
Loading
Loading
Loading
+2 −2
Changes for src/main-conf.c: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -1303,9 +1303,9 @@ masscan_set_parameter(struct Masscan *masscan,
    } else if (EQUALS("nointeractive", name)) {
        masscan->output.is_interactive = 0;
    } else if (EQUALS("status", name)) {
        masscan->output.status_updates = 1;
        masscan->output.is_status_updates = 1;
    } else if (EQUALS("nostatus", name)) {
        masscan->output.status_updates = 0;
        masscan->output.is_status_updates = 0;
    } else if (EQUALS("ip-options", name)) {
        fprintf(stderr, "nmap(%s): unsupported: maybe soon\n", name);
        exit(1);
+2 −2
Changes for src/main-globals.h: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -2,8 +2,8 @@
#define MAIN_GLOBALS_H
#include <time.h>

extern unsigned volatile tx_done;
extern unsigned volatile rx_done;
extern unsigned volatile is_tx_done;
extern unsigned volatile is_rx_done;
extern time_t global_now;


+1 −1
Changes for src/main-status.c: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ status_print(
                        total_tcbs
                        );
    } else {
        if (tx_done) {
        if (is_tx_done) {
            fprintf(stderr,
                "rate:%6.2f-kpps, %5.2f%% done, waiting %d-secs, found=%" PRIu64 "       \r",
                        x/1000.0,
+18 −18
Changes for src/main.c: 18 added lines, 18 removed lines.
Original line number Diff line number Diff line
@@ -77,8 +77,8 @@
/*
 * yea I know globals suck
 */
unsigned volatile tx_done = 0;
unsigned volatile rx_done = 0;
unsigned volatile is_tx_done = 0;
unsigned volatile is_rx_done = 0;
time_t global_now;


@@ -441,7 +441,7 @@ infinite:
        /* If the user pressed <ctrl-c>, then we need to exit. but, in case
         * the user wants to --resume the scan later, we save the current
         * state in a file */
        if (tx_done) {
        if (is_tx_done) {
            break;
        }
    }
@@ -450,7 +450,7 @@ infinite:
     * --infinite
     *  For load testing, go around and do this again
     */
    if (masscan->is_infinite && !tx_done) {
    if (masscan->is_infinite && !is_tx_done) {
        seed++;
        repeats++;
        goto infinite;
@@ -468,7 +468,7 @@ infinite:
     * Wait until the receive thread realizes the scan is over
     */
    LOG(1, "Transmit thread done, waiting for receive thread to realize this\n");
    while (!tx_done)
    while (!is_tx_done)
        pixie_usleep(1000);

    /*
@@ -477,7 +477,7 @@ infinite:
     * packets to arrive. Pressing <ctrl-c> a second time will exit this
     * prematurely.
     */
    while (!rx_done) {
    while (!is_rx_done) {
        unsigned k;
        uint64_t batch_size;

@@ -661,7 +661,7 @@ receive_thread(void *v)
     * wait until transmitter thread is done then go to the end
     */
    if (masscan->is_offline) {
        while (!rx_done)
        while (!is_rx_done)
            pixie_usleep(10000);
        parms->done_receiving = 1;
        goto end;
@@ -672,7 +672,7 @@ receive_thread(void *v)
     * them to the terminal.
     */
    LOG(1, "begin receive thread\n");
    while (!rx_done) {
    while (!is_rx_done) {
        int status;
        unsigned length;
        unsigned secs;
@@ -1014,10 +1014,10 @@ static void control_c_handler(int x)
                );
        fflush(stderr);
        control_c_pressed = 1+x;
        tx_done = control_c_pressed;
        is_tx_done = control_c_pressed;
    } else {
        control_c_pressed_again = 1;
        rx_done = control_c_pressed_again;
        is_rx_done = control_c_pressed_again;
    }

}
@@ -1261,7 +1261,7 @@ main_scan(struct Masscan *masscan)
     */
    status_start(&status);
    status.is_infinite = masscan->is_infinite;
    while (!tx_done) {
    while (!is_tx_done) {
        unsigned i;
        double rate = 0;
        uint64_t total_tcbs = 0;
@@ -1289,14 +1289,14 @@ main_scan(struct Masscan *masscan)

        if (min_index >= range && !masscan->is_infinite) {
            /* Note: This is how we can tell the scan has ended */
            tx_done = 1;
            is_tx_done = 1;
        }

        /*
         * update screen about once per second with statistics,
         * namely packets/second.
         */
        if (masscan->output.status_updates)
        if (masscan->output.is_status_updates)
            status_print(&status, min_index, range, rate,
                total_tcbs, total_synacks, total_syns,
                0);
@@ -1351,13 +1351,13 @@ main_scan(struct Masscan *masscan)
        }


        if (masscan->output.status_updates)
        if (masscan->output.is_status_updates)
            status_print(&status, min_index, range, rate,
                total_tcbs, total_synacks, total_syns,
                masscan->wait - (time(0) - now));

        if (time(0) - now >= masscan->wait)
            rx_done = 1;
            is_rx_done = 1;

        for (i=0; i<masscan->nic_count; i++) {
            struct ThreadPair *parms = &parms_array[i];
@@ -1371,8 +1371,8 @@ main_scan(struct Masscan *masscan)

        if (transmit_count < masscan->nic_count)
            continue;
        tx_done = 1;
        rx_done = 1;
        is_tx_done = 1;
        is_rx_done = 1;
        if (receive_count < masscan->nic_count)
            continue;
        break;
@@ -1414,7 +1414,7 @@ int main(int argc, char *argv[])
    memset(masscan, 0, sizeof(*masscan));
    masscan->blackrock_rounds = 4;
    masscan->output.is_show_open = 1; /* default: show syn-ack, not rst */
    masscan->output.status_updates = 1; /* default: show status updates */
    masscan->output.is_status_updates = 1; /* default: show status updates */
    masscan->seed = get_entropy(); /* entropy for randomness */
    masscan->wait = 10; /* how long to wait for responses when done */
    masscan->max_rate = 100.0; /* max rate = hundred packets-per-second */
+1 −1
Changes for src/masscan.h: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -297,7 +297,7 @@ struct Masscan
        /**
        * Print state updates
        */
        unsigned status_updates:1;
        unsigned is_status_updates:1;

        struct {
            /**
Loading