Initializing the timestamp variables avoids accesssing uninitialized
memory when using --icmp-timestamp with an IPv6 target.
Per RFC 792, setting the high bit indicates a non-standard value,
i.e., this is not a valid timestamp. Thus this value can be
distinguished from valid timestamps.
int ip_header_tos = -1;
int ip_header_ttl = -1;
// ICMP Timestamp
- uint32_t ip_header_otime_ms;
- uint32_t ip_header_rtime_ms;
- uint32_t ip_header_ttime_ms;
+ uint32_t ip_header_otime_ms = 0x80000000U;
+ uint32_t ip_header_rtime_ms = 0x80000000U;
+ uint32_t ip_header_ttime_ms = 0x80000000U;
/* Receive packet */
result = receive_packet(wait_time, /* max. wait time, in ns */