summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2016-10-09 13:52:49 +0100
committerFrediano Ziglio <fziglio@redhat.com>2016-10-09 13:55:40 +0100
commit2419a1a9d5f6e9d5e7f7134558673600436da254 (patch)
treeef3cb39f4d7f1adb3227bc64ce3b8987ffec2a8b
parentdfb61498187a2d4e8db3c65c218ed95d69b5f9a7 (diff)
Allows to specify a capture file at command line
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
-rw-r--r--README.md2
-rw-r--r--latency.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/README.md b/README.md
index 0cf8c94..b1f98d4 100644
--- a/README.md
+++ b/README.md
@@ -19,6 +19,8 @@ Currently requires root privileges as use tun/tap.
* `--port` *port*:
specify the port to use for client/server.
The default is `61234`.
+ * `--cap-file` *filename*:
+ specify a file name to write captured packets (in tcpdump/pcap format).
* `--help`:
show usage help.
diff --git a/latency.c b/latency.c
index c74388f..eacf349 100644
--- a/latency.c
+++ b/latency.c
@@ -66,6 +66,7 @@ usage(bool error)
"Options:\n"
" -h, --help Show this help\n"
" --port <PORT> Specify port to use (default 61234)\n"
+ " --cap-file <FN> Specify a capture file\n"
);
exit(error ? EXIT_FAILURE : EXIT_SUCCESS);
}
@@ -116,11 +117,12 @@ main(int argc, char **argv)
}
enum { MODE_local, MODE_server, MODE_client } mode = MODE_local;
- enum { ARG_port = 256, ARG_client, ARG_server };
+ enum { ARG_port = 256, ARG_client, ARG_server, ARG_capfile };
static struct option long_options[] = {
{"client", required_argument, 0, ARG_client },
{"server", no_argument, 0, ARG_server },
{"port", required_argument, 0, ARG_port },
+ {"cap-file",required_argument, 0, ARG_capfile },
{"help", no_argument, 0, 'h' },
{0, 0, 0, 0 }
};
@@ -146,6 +148,9 @@ main(int argc, char **argv)
case ARG_port:
str_port = optarg;
break;
+ case ARG_capfile:
+ tun_log_filename = optarg;
+ break;
default:
usage(true);
}