From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by passt.top (Postfix, from userid 1000) id 524515A0267; Mon, 24 Oct 2022 15:04:59 +0200 (CEST) From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH] conf: Don't pass leading ~ to parse_port_range() on exclusions Date: Mon, 24 Oct 2022 15:04:59 +0200 Message-Id: <20221024130459.929530-1-sbrivio@redhat.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 52RSGBL42DTMKV3XVHZDJIVG4LUKG2XL X-Message-ID-Hash: 52RSGBL42DTMKV3XVHZDJIVG4LUKG2XL X-MailFrom: sbrivio@passt.top 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 , Alona Paz X-Mailman-Version: 3.3.3 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: Commit 84fec4e998b6 ("Clean up parsing of port ranges") drops the strspn() call before the parsing of excluded port ranges, because now we're checking against any stray characters at every step. However, that also has the effect of passing ~ as first character to the new parse_port_range(), which makes no sense: we already checked that ~ is the first character before the call, so skip it. Alona reported this output: Invalid port specifier ~15000,~15001,~15006,~15008,~15020,~15021,~15090 while the whole specifier is indeed valid. Reported-by: Alona Paz Fixes: 84fec4e998b6 ("Clean up parsing of port ranges") Signed-off-by: Stefano Brivio --- I'm not introducing new tests with this yet, this is another instance where I would need a test case restarting pasta a bunch of times with several different options instead of a fixed setup. I'll reopen the discussion around: https://archives.passt.top/passt-dev/Yz%2FlXVVDgMEWweTj@yekko/#t Also, I'm posting this for review, but again, let me push this out quickly, as configuration of excluded ports is completely broken at the moment. conf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/conf.c b/conf.c index ed93a60..598c711 100644 --- a/conf.c +++ b/conf.c @@ -262,6 +262,7 @@ static int conf_ports(const struct ctx *c, char optname, const char *optarg, exclude_only = false; continue; } + p++; if (parse_port_range(p, &p, &xrange)) goto bad; -- 2.35.1