提交 7dabdaf3 编写于 作者: W wujianguo 提交者: Zheng Zengkai

selftests/net: udpgso_bench_tx: fix dst ip argument

stable inclusion
from stable-v5.10.90
commit 610af55f9fbead4bd3d5636fa048d1e981a4a90f
bugzilla: 186168 https://gitee.com/openeuler/kernel/issues/I4SHY1

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=610af55f9fbead4bd3d5636fa048d1e981a4a90f

--------------------------------

[ Upstream commit 9c1952ae ]

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: 3a687bef ("selftests: udp gso benchmark")
Signed-off-by: NJianguo Wu <wujianguo@chinatelecom.cn>
Reviewed-by: NWillem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/r/ff620d9f-5b52-06ab-5286-44b945453002@163.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 d48a7a2d
......@@ -419,6 +419,7 @@ static void usage(const char *filepath)
static void parse_opts(int argc, char **argv)
{
const char *bind_addr = NULL;
int max_len, hdrlen;
int c;
......@@ -446,7 +447,7 @@ static void parse_opts(int argc, char **argv)
cfg_cpu = strtol(optarg, NULL, 0);
break;
case 'D':
setup_sockaddr(cfg_family, optarg, &cfg_dst_addr);
bind_addr = optarg;
break;
case 'l':
cfg_runtime_ms = strtoul(optarg, NULL, 10) * 1000;
......@@ -492,6 +493,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_dst_addr);
if (optind != argc)
usage(argv[0]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册