fix ping loss, add ttl from ip header compile .h file to detect changes
This commit is contained in:
@ -15,6 +15,7 @@
|
||||
#include <errno.h>
|
||||
#include <sys/param.h>
|
||||
#include <math.h>
|
||||
#include <netinet/ip.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
@ -23,13 +24,13 @@
|
||||
#define HELP_MESSAGE " [OPTION...] HOST ...\n\
|
||||
Send ICMP ECHO_REQUEST packets to network hosts.\n\
|
||||
\n\
|
||||
-c, --count=N stop after sending NUMBER packets\n\
|
||||
--ttl=N specify N as time-to-live\n\
|
||||
-w, --timeout=N stop after N seconds\n\
|
||||
-i, --interval=N wait N seconds between sending each packet\n\
|
||||
-W, --linger=N number of seconds to wait for response\n\
|
||||
-c, --count=N Stop after sending NUMBER packets\n\
|
||||
--ttl=N Specify N as time-to-live\n\
|
||||
-i, --interval=N Wait N seconds between sending each packet\n\
|
||||
-w, --timeout=N Stop after N seconds\n\
|
||||
-W, --linger=N Number of seconds to wait for response\n\
|
||||
\n\
|
||||
-?, --help give this help list\n"
|
||||
-?, --help Give this help list\n"
|
||||
|
||||
extern int g_stop;
|
||||
|
||||
@ -63,7 +64,6 @@ typedef struct s_settings
|
||||
char *name;
|
||||
|
||||
char current_ip[INET_ADDRSTRLEN];
|
||||
|
||||
} t_settings;
|
||||
|
||||
|
||||
@ -78,6 +78,12 @@ typedef struct s_icmp_echo
|
||||
uint8_t data[40];
|
||||
} t_icmp_echo;
|
||||
|
||||
typedef struct __attribute__((__packed__))
|
||||
{
|
||||
struct iphdr header;
|
||||
t_icmp_echo icmp;
|
||||
} t_icmp_ip_reply;
|
||||
|
||||
typedef struct s_stats
|
||||
{
|
||||
size_t sent;
|
||||
@ -99,8 +105,8 @@ void show_help(t_settings *set, char *name);
|
||||
void send_pings(t_settings *set);
|
||||
uint16_t calc_checksum(void *ptr, size_t len);
|
||||
double timediff(struct timeval *from);
|
||||
void waitlist_remove(t_waitlist **lst, uint16_t seq, t_settings *set, t_stats *stats);
|
||||
void show_ping_res_line(t_waitlist *cur, t_settings *set, uint16_t seq, t_stats *stats);
|
||||
void waitlist_remove(t_waitlist **lst, uint16_t seq, t_settings *set, t_stats *stats, uint8_t ttl);
|
||||
void show_ping_res_line(t_waitlist *cur, t_settings *set, uint16_t seq, t_stats *stats, uint8_t ttl);
|
||||
void waitlist_free(t_waitlist *lst);
|
||||
t_waitlist *send_icmp(t_settings *set, struct addrinfo *host, uint16_t *seq, struct timeval *last, t_stats *stats);
|
||||
void waitlist_add(t_waitlist **waitlist, t_waitlist *elem);
|
||||
|
Reference in New Issue
Block a user