From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 3EFEA5A0265 for ; Tue, 25 Oct 2022 02:22:54 +0200 (CEST) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4MxCMG4yMBz4x1V; Tue, 25 Oct 2022 11:22:50 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1666657370; bh=VBG+WwulBTgGxJqpeRt6l9nOLPKToHNo9rJjc/Uhyp4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RaTn1U3JhtqEHJzndy+S0AmOJfj4v2kzxocDqWuGqQTo5bl1xpDIP3bceDhe9Xekj MgzI4p8jSUW/hr91lQrnHD1pw5hsP17FAJFOJUcJG/qYPQjb36KYOZtbdpGTUN2Q7T 9h0JbiPKWVryT1is2m6+5gTK8WJHJuMOnJjqzOdk= Date: Tue, 25 Oct 2022 10:59:06 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH] conf: Don't pass leading ~ to parse_port_range() on exclusions Message-ID: References: <20221024130459.929530-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="H7uHyAjINIlRe54H" Content-Disposition: inline In-Reply-To: <20221024130459.929530-1-sbrivio@redhat.com> Message-ID-Hash: 7GIXF7OPFQTUQOVEZ2SY55CLB2BWME3L X-Message-ID-Hash: 7GIXF7OPFQTUQOVEZ2SY55CLB2BWME3L 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: passt-dev@passt.top, 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: --H7uHyAjINIlRe54H Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 24, 2022 at 03:04:59PM +0200, Stefano Brivio wrote: > 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. >=20 > 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. >=20 > Alona reported this output: > Invalid port specifier ~15000,~15001,~15006,~15008,~15020,~15021,~15090 >=20 > while the whole specifier is indeed valid. >=20 > Reported-by: Alona Paz > Fixes: 84fec4e998b6 ("Clean up parsing of port ranges") > Signed-off-by: Stefano Brivio Oops, sorry about that. Reviewed-by: David Gibson > --- > 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 >=20 > 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. >=20 > conf.c | 1 + > 1 file changed, 1 insertion(+) >=20 > 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 optna= me, const char *optarg, > exclude_only =3D false; > continue; > } > + p++; > =20 > if (parse_port_range(p, &p, &xrange)) > goto bad; --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --H7uHyAjINIlRe54H Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoULxWu4/Ws0dB+XtgypY4gEwYSIFAmNXJrAACgkQgypY4gEw YSLiVBAA0N/lYI4rFnVSTInBIlp73Kytb0qI2UO2IMWdrzv0s3afNB11UwykjpX+ ax6lfaWe+LfVgR/097eS1SXVRKtDh10uWFsOmM3/wNMf2ksKUme2D2JH/7BIcWUk zvkBWyR6TH4YlGDRf3rymn4mPHJFYg5/JS05q9e8Jcz3cwodw4xHQwFPRYWbb88Q YQgUPDUTElMOTxKe+F7m7JE6xc3zKxY7Ot4tGZ7FlabYV7L3SNmqvmw5nG3q+062 Uee6UqpEu0GMQ7fhfGdXcMwX2hqQ8KD+vJFs3E2oaH993yS1W2jhGBI6h0f7QPxa JdYi5uuSlmkV/348Sv/6Pjoa0m3MUd+oBz7bdfuqNF70MyWYciFOSbYQ6yHRZ9z2 4Ko4IRI9EQu1X+P5epNEZbHugKRdFNa5tVlP7PkPSr6cgxsFoFBth2Jxwrx6+02G 0B7gOs2KAOQEXpWkvCU3rIh1z7/b58oKFniWOpexPt2YPXT0N8ojIFsursHWMWmv SkrqH4ZD4WZtMZgtvzNi05653tMnaAjCPXWjvsJ0eO+SK1urKIXQKLOcON+yZ1cw ZRufbu14Y+v1b/WDk6xJ5XGkT9kG1QLI/K5pK0/LfpKmHYCBS6cxtHZ19nFEcPyg chL740P6MhCYdE/yzgL/uaeZNpVjCO+UhmlP7zqwH4KyLE2qzlQ= =lKp/ -----END PGP SIGNATURE----- --H7uHyAjINIlRe54H--