fix: get right icmp hdr

This commit is contained in:
2025-12-16 07:27:15 -06:00
parent d30abcfc49
commit 07f3076c26

View File

@@ -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)
{
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);
printf("%ld bozo", ntohs(ip_hdr->tot_len) - sizeof(struct iphdr));