From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202602 header.b=m1MiAYPM; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 10BDE5A061B for ; Tue, 07 Apr 2026 05:16:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1775531792; bh=IyRKnOpcAnme0Gf2VdXVTPSEznPcAEFm097BPNkKHXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m1MiAYPMvEGsdWjr4oTCoIeSoOnrGebhLOe/cSr8FuaKGp+u1yc0TpHa8MOWbX3eF cAqu1hsgjOFv5tr+2yABQ5pwxBAdkagvKOnPkT8lXP4Fz19CN/6GOdIZkTzBc3GaHC RJwJ6VwJn055t1z6O6rWPqu/YXWp/NejccQECAsOskHdUmr+oAS2+H1LRI1XudrhwY bCZ5wKgkmivrLR1NRuTvzs5qDiHvLzP8nGeini2QVHWSTX4JCBHsydnZiV4LrtBOgO /Fiwf/NCIx5XCz8wiB1/zZXEdeJu31hxTvAZXX67FXGEdA1AZqBP7hn0586svrVQ5s OZoOy4e42awpg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4fqWZ86tz0z4wLN; Tue, 07 Apr 2026 13:16:32 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH 18/18] conf: Don't pass raw commandline argument to conf_ports_spec() Date: Tue, 7 Apr 2026 13:16:30 +1000 Message-ID: <20260407031630.2457081-19-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260407031630.2457081-1-david@gibson.dropbear.id.au> References: <20260407031630.2457081-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 3K353LR2H6ONG5FMC7URDW2SILSSNV55 X-Message-ID-Hash: 3K353LR2H6ONG5FMC7URDW2SILSSNV55 X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- conf.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/conf.c b/conf.c index de262ef5..4c4d9c2f 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); } /** -- 2.53.0