On Saturday, 4 January 2025 02:36:45 GMT+1 Noah Peterson wrote:
Modify the batctl ping utility to accept both integer and floating-point values for the interval between sending pings. This enhancement allows specifying intervals with subsecond precision.
For example: `sudo batctl ping aa:bb:cc:dd:ee:ff -i 0.5`
Signed-off-by: Noah Peterson noahbpeterson1997@gmail.com
v4: Rebasing on latest commit, reformatting into reverse X-mas tree order based on feedback from Sven sven@narfation.org
Patch was not marked as v4 in the Subject line
v3: Rebasing on latest commit, reformatting code based on comments by Sven sven@narfation.org v2: Fixing use-after-free, adding a missing header file, noted by Sven sven@narfation.org
All the changelogs you added after the v1 are basically wrong (or incomplete)
[...]
found_args += ((*((char*)(optarg - 1)) == optchar ) ? 1 : 2);
ERROR: "(foo*)" should be "(foo *)" #63: FILE: ping.c:120: + found_args += ((*((char*)(optarg - 1)) == optchar ) ? 1 : 2);
ERROR: space prohibited before that close parenthesis ')' #63: FILE: ping.c:120: + found_args += ((*((char*)(optarg - 1)) == optchar ) ? 1 : 2);
Please change it back to the original form.
@@ -178,7 +191,7 @@ static int ping(struct state *state, int argc, char **argv) }
printf("PING %s (%s) %zu(%zu) bytes of data\n", dst_string, mac_string,
packet_len, packet_len + 28);
packet_len, packet_len + 28);
while (!is_aborted) { tv.tv_sec = timeout;
This has nothing to do with the thing this patch is supposed to do. And it is also misaligning things. Please stop this.
@@ -224,7 +237,7 @@ static int ping(struct state *state, int argc, char **argv)
if ((size_t)read_len < packet_len) { printf("Warning - dropping received packet as it is smaller than expected (%zu): %zd\n",
packet_len, read_len);
}packet_len, read_len); goto sleep;
This has nothing to do with the thing this patch is supposed to do. And it is also misaligning things. Please stop this.
@@ -236,10 +249,10 @@ static int ping(struct state *state, int argc, char **argv) case BATADV_ECHO_REPLY: time_delta = end_timer(); printf("%zd bytes from %s icmp_seq=%hu ttl=%d time=%.2f ms",
read_len, dst_string,
ntohs(icmp_packet_in.seqno),
icmp_packet_in.ttl,
time_delta);
read_len, dst_string,
ntohs(icmp_packet_in.seqno),
icmp_packet_in.ttl,
time_delta); if (read_len == sizeof(struct batadv_icmp_packet_rr)) { if (last_rr_cur == icmp_packet_in.rr_cur &&
This has nothing to do with the thing this patch is supposed to do. And it is also misaligning things. Please stop this.
@@ -328,9 +341,9 @@ static int ping(struct state *state, int argc, char **argv)
printf("--- %s ping statistics ---\n", dst_string); printf("%u packets transmitted, %u received, %u%% packet loss\n",
packets_out, packets_in, packets_loss);
printf("rtt min/avg/max/mdev = %.3f/%.3f/%.3f/%.3f ms\n",packets_out, packets_in, packets_loss);
min, avg, max, mdev);
min, avg, max, mdev);
if (packets_in) ret = EXIT_SUCCESS;
This has nothing to do with the thing this patch is supposed to do. And it is also misaligning things. Please stop this.
Kind regards, Sven