Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 3a687bef148d ("selftests: udp gso benchmark")
Signed-off-by: Jianguo Wu <wujianguo@chinatelecom.cn>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/r/ff620d9f-5b52-06ab-5286-44b945453002@163.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

wujianguo and committed by
Jakub Kicinski
9c1952ae f7397cd2

+7 -1
+7 -1
tools/testing/selftests/net/udpgso_bench_tx.c
··· 419 419 420 420 static void parse_opts(int argc, char **argv) 421 421 { 422 + const char *bind_addr = NULL; 422 423 int max_len, hdrlen; 423 424 int c; 424 425 ··· 447 446 cfg_cpu = strtol(optarg, NULL, 0); 448 447 break; 449 448 case 'D': 450 - setup_sockaddr(cfg_family, optarg, &cfg_dst_addr); 449 + bind_addr = optarg; 451 450 break; 452 451 case 'l': 453 452 cfg_runtime_ms = strtoul(optarg, NULL, 10) * 1000; ··· 492 491 break; 493 492 } 494 493 } 494 + 495 + if (!bind_addr) 496 + bind_addr = cfg_family == PF_INET6 ? "::" : "0.0.0.0"; 497 + 498 + setup_sockaddr(cfg_family, bind_addr, &cfg_dst_addr); 495 499 496 500 if (optind != argc) 497 501 usage(argv[0]);