Skip to content

Commit

Permalink
Merge pull request RIOT-OS#4266 from A-Paul/shell_ping6_addrerr
Browse files Browse the repository at this point in the history
ping6: dedicated message at address parsing error
  • Loading branch information
x3ro committed Dec 4, 2015
2 parents 849f690 + 46f3729 commit 80b771a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions sys/shell/commands/sc_icmpv6_echo.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ int _icmpv6_ping(int argc, char **argv)
ipv6_addr_t addr;
msg_t msg;
gnrc_netreg_entry_t *ipv6_entry, my_entry = { NULL, ICMPV6_ECHO_REP,
thread_getpid()
};
thread_getpid() };
uint32_t min_rtt = UINT32_MAX, max_rtt = 0;
uint64_t sum_rtt = 0;
uint64_t ping_start;
Expand Down Expand Up @@ -182,11 +181,16 @@ int _icmpv6_ping(int argc, char **argv)
stat_interval = atoi(argv[4 + param_offset]);
}

if ((ipv6_addr_from_str(&addr, addr_str) == NULL) || (((int)payload_len) < 0)) {
if ((int)payload_len < 0) {
usage(argv);
return 1;
}

if (ipv6_addr_from_str(&addr, addr_str) == NULL) {
puts("error: malformed address");
return 1;
}

if (gnrc_netreg_register(GNRC_NETTYPE_ICMPV6, &my_entry) < 0) {
puts("error: network registry is full");
return 1;
Expand Down

0 comments on commit 80b771a

Please sign in to comment.