fix: get right icmp hdr
This commit is contained in:
@@ -70,7 +70,7 @@ static const char *get_message_description(const uint8_t type, const uint8_t cod
|
|||||||
void print_recv(const struct setting *settings, const char *packet, const struct timeval *start, const struct timeval *stop, struct sockaddr_in const *sender)
|
void print_recv(const struct setting *settings, const char *packet, const struct timeval *start, const struct timeval *stop, struct sockaddr_in const *sender)
|
||||||
{
|
{
|
||||||
const struct iphdr *ip_hdr = (const struct iphdr *) packet;
|
const struct iphdr *ip_hdr = (const struct iphdr *) packet;
|
||||||
const struct icmphdr *icmp_hdr = (const struct icmphdr *) packet + sizeof(struct iphdr);
|
const struct icmphdr *icmp_hdr = (const struct icmphdr *) (packet + sizeof(struct iphdr));
|
||||||
|
|
||||||
char *ipstr = inet_ntoa(sender->sin_addr);
|
char *ipstr = inet_ntoa(sender->sin_addr);
|
||||||
printf("%ld bozo", ntohs(ip_hdr->tot_len) - sizeof(struct iphdr));
|
printf("%ld bozo", ntohs(ip_hdr->tot_len) - sizeof(struct iphdr));
|
||||||
|
|||||||
Reference in New Issue
Block a user