netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, edumazet@google.com,
	Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net] selftests/net: udpgso_bench_rx: fix port argument
Date: Thu, 11 Nov 2021 13:42:40 +0100	[thread overview]
Message-ID: <716a0806cfa4a166e49e865f0b7cf1b18e2a7011.camel@redhat.com> (raw)
In-Reply-To: <20211111115717.1925230-1-willemdebruijn.kernel@gmail.com>

On Thu, 2021-11-11 at 06:57 -0500, Willem de Bruijn wrote:
> From: Willem de Bruijn <willemb@google.com>
> 
> The below commit added optional support for passing a bind address.
> It configures the sockaddr bind arguments before parsing options and
> reconfigures on options -b and -4.
> 
> This broke support for passing port (-p) on its own.
> 
> Configure sockaddr after parsing all arguments.
> 
> Fixes: 3327a9c46352 ("selftests: add functionals test for UDP GRO")
> Reported-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Willem de Bruijn <willemb@google.com>
> ---
>  tools/testing/selftests/net/udpgso_bench_rx.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/udpgso_bench_rx.c b/tools/testing/selftests/net/udpgso_bench_rx.c
> index 76a24052f4b4..6a193425c367 100644
> --- a/tools/testing/selftests/net/udpgso_bench_rx.c
> +++ b/tools/testing/selftests/net/udpgso_bench_rx.c
> @@ -293,19 +293,17 @@ static void usage(const char *filepath)
>  
>  static void parse_opts(int argc, char **argv)
>  {
> +	const char *bind_addr = NULL;
>  	int c;
>  
> -	/* bind to any by default */
> -	setup_sockaddr(PF_INET6, "::", &cfg_bind_addr);
>  	while ((c = getopt(argc, argv, "4b:C:Gl:n:p:rR:S:tv")) != -1) {
>  		switch (c) {
>  		case '4':
>  			cfg_family = PF_INET;
>  			cfg_alen = sizeof(struct sockaddr_in);
> -			setup_sockaddr(PF_INET, "0.0.0.0", &cfg_bind_addr);
>  			break;
>  		case 'b':
> -			setup_sockaddr(cfg_family, optarg, &cfg_bind_addr);
> +			bind_addr = optarg;
>  			break;
>  		case 'C':
>  			cfg_connect_timeout_ms = strtoul(optarg, NULL, 0);
> @@ -341,6 +339,11 @@ static void parse_opts(int argc, char **argv)
>  		}
>  	}
>  
> +	if (!bind_addr)
> +		bind_addr = cfg_family == PF_INET6 ? "::" : "0.0.0.0";
> +
> +	setup_sockaddr(cfg_family, bind_addr, &cfg_bind_addr);
> +
>  	if (optind != argc)
>  		usage(argv[0]);
>  
LGTM, thanks Willem,

Acked-by: Paolo Abeni <pabeni@redhat.com>


      parent reply	other threads:[~2021-11-11 12:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 11:57 [PATCH net] selftests/net: udpgso_bench_rx: fix port argument Willem de Bruijn
2021-11-11 12:30 ` patchwork-bot+netdevbpf
2021-11-11 12:42 ` Paolo Abeni [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=716a0806cfa4a166e49e865f0b7cf1b18e2a7011.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=willemb@google.com \
    --cc=willemdebruijn.kernel@gmail.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.
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 NNTP newsgroup(s).