Lines Matching +full:dummy +full:- +full:bytes +full:- +full:count

5  * SPDX-License-Identifier: Apache-2.0
36 uint32_t count; member
56 struct net_ipv6_hdr *ip_hdr = hdr->ipv6; in handle_ipv6_echo_reply()
64 return -EIO; in handle_ipv6_echo_reply()
71 return -EIO; in handle_ipv6_echo_reply()
74 cycles = k_cycle_get_32() - cycles; in handle_ipv6_echo_reply()
87 PR_SHELL(ping_ctx.sh, "%d bytes from %s to %s: icmp_seq=%d ttl=%d " in handle_ipv6_echo_reply()
92 ntohs(ip_hdr->len) - net_pkt_ipv6_ext_len(pkt) - in handle_ipv6_echo_reply()
94 net_sprint_ipv6_addr(&ip_hdr->src), in handle_ipv6_echo_reply()
95 net_sprint_ipv6_addr(&ip_hdr->dst), in handle_ipv6_echo_reply()
96 ntohs(icmp_echo->sequence), in handle_ipv6_echo_reply()
97 ip_hdr->hop_limit, in handle_ipv6_echo_reply()
103 if (ntohs(icmp_echo->sequence) == ping_ctx.count) { in handle_ipv6_echo_reply()
122 return -ENOTSUP; in handle_ipv6_echo_reply()
136 struct net_ipv4_hdr *ip_hdr = hdr->ipv4; in handle_ipv4_echo_reply()
144 return -EIO; in handle_ipv4_echo_reply()
151 return -EIO; in handle_ipv4_echo_reply()
154 cycles = k_cycle_get_32() - cycles; in handle_ipv4_echo_reply()
167 PR_SHELL(ping_ctx.sh, "%d bytes from %s to %s: icmp_seq=%d ttl=%d " in handle_ipv4_echo_reply()
169 ntohs(ip_hdr->len) - net_pkt_ipv6_ext_len(pkt) - in handle_ipv4_echo_reply()
171 net_sprint_ipv4_addr(&ip_hdr->src), in handle_ipv4_echo_reply()
172 net_sprint_ipv4_addr(&ip_hdr->dst), in handle_ipv4_echo_reply()
173 ntohs(icmp_echo->sequence), in handle_ipv4_echo_reply()
174 ip_hdr->ttl, in handle_ipv4_echo_reply()
177 if (ntohs(icmp_echo->sequence) == ping_ctx.count) { in handle_ipv4_echo_reply()
196 return -ENOTSUP; in handle_ipv4_echo_reply()
209 return -1; in parse_arg()
225 return -1; in parse_arg()
233 (void)net_icmp_cleanup_ctx(&ctx->icmp); in ping_cleanup()
234 shell_set_bypass(ctx->sh, NULL); in ping_cleanup()
239 k_work_cancel_delayable(&ctx->work); in ping_done()
241 /* Dummy write to refresh the prompt. */ in ping_done()
242 shell_fprintf(ctx->sh, SHELL_NORMAL, ""); in ping_done()
250 const struct shell *sh = ctx->sh; in ping_work()
254 ctx->sequence++; in ping_work()
256 if (ctx->sequence > ctx->count) { in ping_work()
262 if (ctx->sequence < ctx->count) { in ping_work()
263 k_work_reschedule(&ctx->work, K_MSEC(ctx->interval)); in ping_work()
265 k_work_reschedule(&ctx->work, K_SECONDS(2)); in ping_work()
269 params.sequence = ctx->sequence; in ping_work()
270 params.tc_tos = ctx->tos; in ping_work()
271 params.priority = ctx->priority; in ping_work()
273 params.data_size = ctx->payload_size; in ping_work()
275 ret = net_icmp_send_echo_request_no_wait(&ctx->icmp, in ping_work()
276 ctx->iface, in ping_work()
277 &ctx->addr, in ping_work()
310 if (IS_ENABLED(CONFIG_NET_IPV4) && target->sa_family == AF_INET) { in ping_select_iface()
311 iface = net_if_ipv4_select_src_iface(&net_sin(target)->sin_addr); in ping_select_iface()
320 if (IS_ENABLED(CONFIG_NET_IPV6) && target->sa_family == AF_INET6) { in ping_select_iface()
326 iface = net_if_ipv6_select_src_iface(&net_sin6(target)->sin6_addr); in ping_select_iface()
331 nbr = net_ipv6_nbr_lookup(NULL, &net_sin6(target)->sin6_addr); in ping_select_iface()
333 iface = nbr->iface; in ping_select_iface()
338 route = net_route_lookup(NULL, &net_sin6(target)->sin6_addr); in ping_select_iface()
340 iface = route->iface; in ping_select_iface()
361 return -EOPNOTSUPP; in cmd_net_ping()
365 int count = 3; in cmd_net_ping()
367 int iface_idx = -1; in cmd_net_ping()
370 int priority = -1; in cmd_net_ping()
375 if (*argv[i] != '-') { in cmd_net_ping()
382 count = parse_arg(&i, argc, argv); in cmd_net_ping()
383 if (count < 0) { in cmd_net_ping()
385 return -ENOEXEC; in cmd_net_ping()
394 return -ENOEXEC; in cmd_net_ping()
403 return -ENOEXEC; in cmd_net_ping()
411 return -ENOEXEC; in cmd_net_ping()
419 return -ENOEXEC; in cmd_net_ping()
428 return -ENOEXEC; in cmd_net_ping()
435 return -ENOEXEC; in cmd_net_ping()
441 return -ENOEXEC; in cmd_net_ping()
449 ping_ctx.count = count; in cmd_net_ping()
492 SHELL_CMD(--help, NULL,
493 "'net ping [-c count] [-i interval ms] [-I <iface index>] "
494 "[-Q tos] [-s payload size] [-p priority] <host>' "
495 "Send ICMPv4 or ICMPv6 Echo-Request to a network host.",