hardcode ICMP header len
struct icmphdr
is different for BSD and GNU libc:
BSD code:
/*
* Structure of an icmp header.
*/
struct icmphdr {
u_char icmp_type; /* type of message, see below */
u_char icmp_code; /* type sub code */
u_short icmp_cksum; /* ones complement cksum of struct */
};
GNU code:
struct icmphdr
{
uint8_t type; /* message type */
uint8_t code; /* type sub-code */
uint16_t checksum;
union
{
struct
{
uint16_t id;
uint16_t sequence;
} echo; /* echo datagram */
uint32_t gateway; /* gateway address */
struct
{
uint16_t __glibc_reserved;
uint16_t mtu;
} frag; /* path mtu discovery */
} un;
};
Because of that calculations of ICMP message header len vary on different systems, and also some UTs related to ping-check hook fail on FreeBSD.
ICMP header len could be defined inside of ICMPMsg
class.