diff --git a/src/send/api/echo.c b/src/send/api/echo.c index 1c30bd3..b0b0fe7 100644 --- a/src/send/api/echo.c +++ b/src/send/api/echo.c @@ -1,5 +1,4 @@ #include "icmp.h" -#include "internal/icmp_send.h" #include "icmp_types.h" #include @@ -7,11 +6,13 @@ int icmp_send_echo(icmp_handle_t *h, struct in_addr dest, uint16_t id, uint16_t seq, uint8_t ttl) { - if (0 == send_validate_handle(h)) - return -1; + union { + struct { uint16_t id; uint16_t seq; } echo; + uint32_t raw; + } hdr_rest; - uint32_t header_rest = (uint32_t)id | ((uint32_t)seq << 16); - - return icmp_send_raw(h, ICMP_TYPE_ECHO_REQUEST, 0, header_rest, + hdr_rest.echo.id = id; + hdr_rest.echo.seq = seq; + return icmp_send_raw(h, ICMP_TYPE_ECHO_REQUEST, 0, hdr_rest.raw, NULL, 0, dest, ttl); }