Re: [PATCH 1/1] tidbits: net-ping: add ping tidbit using raw socket
Philippe Gerum <[email protected]> Sun, 05 Jul 2026 18:52:15 +0200
| Newsgroups | dev.linux.lists.xenomai |
|---|---|
| Message-ID | <[email protected]> |
Hannes Diethelm <[email protected]> writes: > Am 05.07.26 um 16:57 schrieb Philippe Gerum: >> Hannes Diethelm <[email protected]> writes: >> >>> This tidbit allows to ping any host and measure the response time. >>> >>> Signed-off-by: Hannes Diethelm <[email protected]> >>> --- >>> tidbits/meson.build | 6 + >>> tidbits/oob-net-ping.c | 480 +++++++++++++++++++++++++++++++++++++++++ >>> 2 files changed, 486 insertions(+) >>> create mode 100644 tidbits/oob-net-ping.c >>> >> Thanks. We need this to build on 32bit systems: >> --- a/tidbits/oob-net-ping.c >> +++ b/tidbits/oob-net-ping.c >> @@ -215,7 +215,7 @@ static size_t build_icmp_request(uint8_t *o_frame, size_t icmplen, >> icmphdr->checksum = cksum; >> if (verbosity > 1) { >> - evl_printf("ip_len=%zd, icmp_len=%zd, ip_len=%d, datalen=%ld\n", >> + evl_printf("ip_len=%zd, icmp_len=%zd, ip_len=%d, datalen=%zu\n", >> sizeof(*iphdr), sizeof(struct icmphdr), >> ntohs(iphdr->ip_len), datalen); >> print_ip_header(iphdr); >> What about turning this code into the (currently missing) 'evl-ping' >> utility? I believe it is of general interest to any user. >> > > Thanks, I will fix this. > > Why not. So I would move the code in the tools place and rename it? Meanwhile, > I was continuing work, so statistics are available, ping style. > > oob-ping: > 2 packets transmitted, 2 received, 0% packet loss, time 1633ms > rtt min/avg/max/mdev = 226.8/248.3/269.9/21.6 us > Yep, that's nice. We would make good use of this program as a standard evl utility. > ping: > 3 packets transmitted, 3 received, 0% packet loss, time 2030ms > rtt min/avg/max/mdev = 0.118/0.142/0.159/0.017 ms > > The only difference is, that I use us instead of ms. That could confuse some users. > What do you think, stay at us or use ms? > I would stick with the standard ping convention (ms), maybe adding an option to display delays in microseconds. > BTW: This is in a VM, that's the reason for the bad timing. Noted. -- Philippe.