🏗️」 wip: TODO

This commit is contained in:
2025-08-16 21:43:15 +02:00
parent ac8e8638e9
commit 4c13d78559
4 changed files with 19 additions and 0 deletions

View File

@ -49,6 +49,7 @@ void process_icmp(char *buf, int bytes, struct sockaddr_in *addr, int seq,
append_time(rtt);
// TODO: fix the time and put the hostname with the ip
printf("%d bytes from %s: icmp_seq=%d ttl=%d time=%.3f\n", bytes - len,
inet_ntoa(addr->sin_addr), icmp->icmp_seq, ip->ip_ttl, rtt);
}

View File

@ -81,6 +81,7 @@ int send_ping(int socket, struct sockaddr_in *dest, options_t opt) {
return EXIT_SUCCESS;
}
// TODO: fix this shitty loop
int ping(args_t *args) {
int ret;
options_t opt = init_opt(args);

View File

@ -61,10 +61,12 @@ bool check_for_timeout(struct timeval start, options_t opt) {
return false;
}
// TODO: fix the packet loss
void print_stats(void) {
printf("--- %s ping statistics ---\n", address);
printf("%d packets transmitted, %d packets received, %.0f%% packet loss\n",
tx_count, rx_count, (tx_count - rx_count / 2.0) * 100);
// TODO: fix this shit
printf("round-trip min/avg/max/stddev = %.3f/%.3f/%.3f/%.3f\n",
get_min_rtt(), get_avg_rtt(), get_max_rtt(), get_stddev_rtt());
}