add --ttl and -v flag
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/26 19:54:25 by tomoron #+# #+# */
|
||||
/* Updated: 2025/05/22 23:01:33 by tomoron ### ########.fr */
|
||||
/* Updated: 2025/06/01 22:09:27 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -40,7 +40,10 @@ struct addrinfo *resolve_ip(char *host, t_settings *settings)
|
||||
|
||||
void ping_start_print(t_settings *set, char *host)
|
||||
{
|
||||
printf("PING %s (%s): 56 data bytes\n", host, set->current_ip);
|
||||
printf("PING %s (%s): 56 data bytes", host, set->current_ip);
|
||||
if(set->verbose)
|
||||
printf(", id 0x%04x = %d", set->id, set->id);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void ping_end_print(t_settings *set, char *host, t_stats *stats)
|
||||
@ -100,6 +103,8 @@ void send_pings(t_settings *set)
|
||||
t_host_list *cur;
|
||||
|
||||
cur = set->hosts;
|
||||
if(set->setTtl)
|
||||
setsockopt(set->socket, IPPROTO_IP, IP_TTL, &set->ttl, sizeof(set->ttl));
|
||||
while(cur)
|
||||
{
|
||||
if(!ping_host(set, cur->host))
|
||||
|
Reference in New Issue
Block a user