Skip to content

Commit 9c1952a

Browse files
wujianguokuba-moo
authored andcommitted
selftests/net: udpgso_bench_tx: fix dst ip argument
udpgso_bench_tx call setup_sockaddr() for dest address before parsing all arguments, if we specify "-p ${dst_port}" after "-D ${dst_ip}", then ${dst_port} will be ignored, and using default cfg_port 8000. This will cause test case "multiple GRO socks" failed in udpgro.sh. Setup sockaddr after parsing all arguments. Fixes: 3a687be ("selftests: udp gso benchmark") Signed-off-by: Jianguo Wu <[email protected]> Reviewed-by: Willem de Bruijn <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent f7397cd commit 9c1952a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tools/testing/selftests/net/udpgso_bench_tx.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ static void usage(const char *filepath)
419419

420420
static void parse_opts(int argc, char **argv)
421421
{
422+
const char *bind_addr = NULL;
422423
int max_len, hdrlen;
423424
int c;
424425

@@ -446,7 +447,7 @@ static void parse_opts(int argc, char **argv)
446447
cfg_cpu = strtol(optarg, NULL, 0);
447448
break;
448449
case 'D':
449-
setup_sockaddr(cfg_family, optarg, &cfg_dst_addr);
450+
bind_addr = optarg;
450451
break;
451452
case 'l':
452453
cfg_runtime_ms = strtoul(optarg, NULL, 10) * 1000;
@@ -492,6 +493,11 @@ static void parse_opts(int argc, char **argv)
492493
}
493494
}
494495

496+
if (!bind_addr)
497+
bind_addr = cfg_family == PF_INET6 ? "::" : "0.0.0.0";
498+
499+
setup_sockaddr(cfg_family, bind_addr, &cfg_dst_addr);
500+
495501
if (optind != argc)
496502
usage(argv[0]);
497503

0 commit comments

Comments
 (0)