aboutgitcodebugslistschat
path: root/conf.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-08-26 14:58:32 +1000
committerStefano Brivio <sbrivio@redhat.com>2022-08-30 19:17:57 +0200
commitbf95322fc1ef2d0d7a21cb0e6a9bf01902024859 (patch)
tree591d27594b910183c5a42df3b496f06855bf0f41 /conf.c
parent63d13902296e39221b16941db4525e0efa8ce218 (diff)
downloadpasst-bf95322fc1ef2d0d7a21cb0e6a9bf01902024859.tar
passt-bf95322fc1ef2d0d7a21cb0e6a9bf01902024859.tar.gz
passt-bf95322fc1ef2d0d7a21cb0e6a9bf01902024859.tar.bz2
passt-bf95322fc1ef2d0d7a21cb0e6a9bf01902024859.tar.lz
passt-bf95322fc1ef2d0d7a21cb0e6a9bf01902024859.tar.xz
passt-bf95322fc1ef2d0d7a21cb0e6a9bf01902024859.tar.zst
passt-bf95322fc1ef2d0d7a21cb0e6a9bf01902024859.zip
conf: Make the argument to --pcap option mandatory
The --pcap or -p option can be used with or without an argument. If given, the argument gives the name of the file to save a packet trace to. If omitted, we generate a default name in /tmp. Generating the default name isn't particularly useful though, since making a suitable name can easily be done by the caller. Remove this feature. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'conf.c')
-rw-r--r--conf.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/conf.c b/conf.c
index d936157..4eb9e3d 100644
--- a/conf.c
+++ b/conf.c
@@ -737,14 +737,7 @@ static void usage(const char *name)
UNIX_SOCK_PATH, 1);
}
- info( " -p, --pcap [FILE] Log tap-facing traffic to pcap file");
- info( " if FILE is not given, log to:");
-
- if (strstr(name, "pasta"))
- info(" /tmp/pasta_ISO8601-TIMESTAMP_PID.pcap");
- else
- info(" /tmp/passt_ISO8601-TIMESTAMP_PID.pcap");
-
+ info( " -p, --pcap FILE Log tap-facing traffic to pcap file");
info( " -P, --pid FILE Write own PID to the given file");
info( " -m, --mtu MTU Assign MTU via DHCP/NDP");
info( " a zero value disables assignment");
@@ -1021,7 +1014,7 @@ void conf(struct ctx *c, int argc, char **argv)
{"help", no_argument, NULL, 'h' },
{"socket", required_argument, NULL, 's' },
{"ns-ifname", required_argument, NULL, 'I' },
- {"pcap", optional_argument, NULL, 'p' },
+ {"pcap", required_argument, NULL, 'p' },
{"pid", required_argument, NULL, 'P' },
{"mtu", required_argument, NULL, 'm' },
{"address", required_argument, NULL, 'a' },
@@ -1084,7 +1077,7 @@ void conf(struct ctx *c, int argc, char **argv)
name = getopt_long(argc, argv, optstring, options, NULL);
- if ((name == 'p' || name == 'D' || name == 'S') && !optarg &&
+ if ((name == 'D' || name == 'S') && !optarg &&
optind < argc && *argv[optind] && *argv[optind] != '-') {
if (c->mode == MODE_PASTA) {
if (conf_ns_opt(c, nsdir, userns, argv[optind]))
@@ -1289,11 +1282,6 @@ void conf(struct ctx *c, int argc, char **argv)
usage(argv[0]);
}
- if (!optarg) {
- *c->pcap = 1;
- break;
- }
-
ret = snprintf(c->pcap, sizeof(c->pcap), "%s", optarg);
if (ret <= 0 || ret >= (int)sizeof(c->pcap)) {
err("Invalid pcap path: %s", optarg);