public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-dev@passt.top, Alona Paz <alkaplan@redhat.com>
Subject: Re: [PATCH] conf: Don't pass leading ~ to parse_port_range() on exclusions
Date: Tue, 25 Oct 2022 10:59:06 +1100	[thread overview]
Message-ID: <Y1cmygjhLro5IMXE@yekko> (raw)
In-Reply-To: <20221024130459.929530-1-sbrivio@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1954 bytes --]

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.
> 
> 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 <alkaplan@redhat.com>
> Fixes: 84fec4e998b6 ("Clean up parsing of port ranges")
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>

Oops, sorry about that.

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
> 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;

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2022-10-25  0:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-24 13:04 [PATCH] conf: Don't pass leading ~ to parse_port_range() on exclusions Stefano Brivio
2022-10-24 23:59 ` David Gibson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y1cmygjhLro5IMXE@yekko \
    --to=david@gibson.dropbear.id.au \
    --cc=alkaplan@redhat.com \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).