diff options
author | Frediano Ziglio <fziglio@redhat.com> | 2016-10-09 13:52:49 +0100 |
---|---|---|
committer | Frediano Ziglio <fziglio@redhat.com> | 2016-10-09 13:55:40 +0100 |
commit | 2419a1a9d5f6e9d5e7f7134558673600436da254 (patch) | |
tree | ef3cb39f4d7f1adb3227bc64ce3b8987ffec2a8b | |
parent | dfb61498187a2d4e8db3c65c218ed95d69b5f9a7 (diff) |
Allows to specify a capture file at command line
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | latency.c | 7 |
2 files changed, 8 insertions, 1 deletions
@@ -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. @@ -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); } |