aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2026-04-17 15:05:14 +1000
committerStefano Brivio <sbrivio@redhat.com>2026-04-21 02:09:35 +0200
commit2230d5b81a0d063aade36155f9e1846940852eb0 (patch)
treea4925e0af5abaa9126b83da1cac53e652b5d84d1
parent0521f83e82295b1ac6b6704fb1b5294519090bca (diff)
downloadpasst-2230d5b81a0d063aade36155f9e1846940852eb0.tar
passt-2230d5b81a0d063aade36155f9e1846940852eb0.tar.gz
passt-2230d5b81a0d063aade36155f9e1846940852eb0.tar.bz2
passt-2230d5b81a0d063aade36155f9e1846940852eb0.tar.lz
passt-2230d5b81a0d063aade36155f9e1846940852eb0.tar.xz
passt-2230d5b81a0d063aade36155f9e1846940852eb0.tar.zst
passt-2230d5b81a0d063aade36155f9e1846940852eb0.zip
conf: Don't pass raw commandline argument to conf_ports_spec()
We only use the optname and optarg parameters for printing error messages, and they're not even particularly necessary there. Remove them. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--conf.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/conf.c b/conf.c
index 7efdf53..dd5c678 100644
--- a/conf.c
+++ b/conf.c
@@ -219,8 +219,6 @@ fail:
/**
* conf_ports_spec() - Parse port range(s) specifier
* @c: Execution context
- * @optname: Short option name, t, T, u, or U
- * @optarg: Option argument (port specification)
* @fwd: Forwarding table to be updated
* @proto: Protocol to forward
* @addr: Listening address for forwarding
@@ -228,7 +226,6 @@ fail:
* @spec: Port range(s) specifier
*/
static void conf_ports_spec(const struct ctx *c,
- char optname, const char *optarg,
struct fwd_table *fwd, uint8_t proto,
const union inany_addr *addr, const char *ifname,
const char *spec)
@@ -316,8 +313,7 @@ static void conf_ports_spec(const struct ctx *c,
goto bad;
if (orig_range.first == 0) {
- die("Can't forward port 0 for option '-%c %s'",
- optname, optarg);
+ die("Can't forward port 0 included in '%s'", spec);
}
conf_ports_range_except(fwd, proto, addr, ifname,
@@ -328,7 +324,7 @@ static void conf_ports_spec(const struct ctx *c,
return;
bad:
- die("Invalid port specifier %s", optarg);
+ die("Invalid port specifier '%s'", spec);
}
/**
@@ -432,11 +428,11 @@ static void conf_ports(const struct ctx *c, char optname, const char *optarg,
optname, optarg);
if (c->ifi4) {
- conf_ports_spec(c, optname, optarg, fwd, proto,
+ conf_ports_spec(c, fwd, proto,
&inany_loopback4, NULL, spec);
}
if (c->ifi6) {
- conf_ports_spec(c, optname, optarg, fwd, proto,
+ conf_ports_spec(c, fwd, proto,
&inany_loopback6, NULL, spec);
}
return;
@@ -451,7 +447,7 @@ static void conf_ports(const struct ctx *c, char optname, const char *optarg,
optname, optarg);
}
- conf_ports_spec(c, optname, optarg, fwd, proto, addr, ifname, spec);
+ conf_ports_spec(c, fwd, proto, addr, ifname, spec);
}
/**