net: zperf: Distinguish between IPv4 and IPv6 address set failures
Using a generic IP for address set failures is confusing, esp. two same prints (one for v4 and the other for v6), so, use explicit version. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This commit is contained in:
parent
e75e04d2d2
commit
6bd47ffb10
@ -224,7 +224,7 @@ static int cmd_setip(const struct shell *sh, size_t argc, char *argv[])
|
||||
if (zperf_get_ipv6_addr(argv[start + 1], argv[start + 2],
|
||||
&shell_ipv6) < 0) {
|
||||
shell_fprintf(sh, SHELL_WARNING,
|
||||
"Unable to set IP\n");
|
||||
"Unable to set %s address (%s disabled)\n", "IPv6", "IPv4");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -241,7 +241,7 @@ static int cmd_setip(const struct shell *sh, size_t argc, char *argv[])
|
||||
|
||||
if (zperf_get_ipv4_addr(argv[start + 1], &shell_ipv4) < 0) {
|
||||
shell_fprintf(sh, SHELL_WARNING,
|
||||
"Unable to set IP\n");
|
||||
"Unable to set %s address (%s disabled)\n", "IPv4", "IPv6");
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ static int cmd_setip(const struct shell *sh, size_t argc, char *argv[])
|
||||
if (zperf_get_ipv4_addr(argv[start + 1],
|
||||
&shell_ipv4) < 0) {
|
||||
shell_fprintf(sh, SHELL_WARNING,
|
||||
"Unable to set IP\n");
|
||||
"Unable to set %s address\n", "IPv4");
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
@ -276,7 +276,7 @@ static int cmd_setip(const struct shell *sh, size_t argc, char *argv[])
|
||||
if (zperf_get_ipv6_addr(argv[start + 1],
|
||||
argv[start + 2], &shell_ipv6) < 0) {
|
||||
shell_fprintf(sh, SHELL_WARNING,
|
||||
"Unable to set IP\n");
|
||||
"Unable to set %s address\n", "IPv6");
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
@ -1199,7 +1199,7 @@ void zperf_shell_init(void)
|
||||
ret = net_addr_pton(AF_INET6, MY_IP6ADDR,
|
||||
&in6_addr_my.sin6_addr);
|
||||
if (ret < 0) {
|
||||
NET_WARN("Unable to set IP");
|
||||
NET_WARN("Unable to set %s address\n", "IPv6");
|
||||
} else {
|
||||
NET_INFO("Setting IP address %s",
|
||||
net_sprint_ipv6_addr(&in6_addr_my.sin6_addr));
|
||||
@ -1208,9 +1208,10 @@ void zperf_shell_init(void)
|
||||
ret = net_addr_pton(AF_INET6, DST_IP6ADDR,
|
||||
&in6_addr_dst.sin6_addr);
|
||||
if (ret < 0) {
|
||||
NET_WARN("Unable to set IP %s",
|
||||
NET_WARN("Unable to set destination %s address %s",
|
||||
"IPv6",
|
||||
DST_IP6ADDR ? DST_IP6ADDR
|
||||
: "(Default IPv6 destination address not set)");
|
||||
: "(not set)");
|
||||
} else {
|
||||
NET_INFO("Setting destination IP address %s",
|
||||
net_sprint_ipv6_addr(&in6_addr_dst.sin6_addr));
|
||||
@ -1221,7 +1222,7 @@ void zperf_shell_init(void)
|
||||
ret = net_addr_pton(AF_INET, MY_IP4ADDR,
|
||||
&in4_addr_my.sin_addr);
|
||||
if (ret < 0) {
|
||||
NET_WARN("Unable to set IP");
|
||||
NET_WARN("Unable to set %s address\n", "IPv4");
|
||||
} else {
|
||||
NET_INFO("Setting IP address %s",
|
||||
net_sprint_ipv4_addr(&in4_addr_my.sin_addr));
|
||||
@ -1230,9 +1231,10 @@ void zperf_shell_init(void)
|
||||
ret = net_addr_pton(AF_INET, DST_IP4ADDR,
|
||||
&in4_addr_dst.sin_addr);
|
||||
if (ret < 0) {
|
||||
NET_WARN("Unable to set IP %s",
|
||||
NET_WARN("Unable to set destination %s address %s",
|
||||
"IPv4",
|
||||
DST_IP4ADDR ? DST_IP4ADDR
|
||||
: "(Default IPv4 destination address not set)");
|
||||
: "(not set)");
|
||||
} else {
|
||||
NET_INFO("Setting destination IP address %s",
|
||||
net_sprint_ipv4_addr(&in4_addr_dst.sin_addr));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user