Skip to content

Commit

Permalink
ping: send the usual number of payload bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
klange committed Feb 10, 2024
1 parent 335bdf1 commit 02fe2bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <netdb.h>
#include <arpa/inet.h>

#define BYTES_TO_SEND 56
#define BYTES_TO_SEND 64

struct ICMP_Header {
uint8_t type, code;
Expand Down Expand Up @@ -87,7 +87,7 @@ int main(int argc, char * argv[]) {
dest.sin_family = AF_INET;
memcpy(&dest.sin_addr.s_addr, host->h_addr, host->h_length);

printf("PING %s (%s) %d data bytes\n", argv[1], addr, BYTES_TO_SEND);
printf("PING %s (%s) %d data bytes\n", argv[1], addr, BYTES_TO_SEND - 8);

struct ICMP_Header * ping = malloc(BYTES_TO_SEND);
ping->type = 8; /* request */
Expand Down

0 comments on commit 02fe2bb

Please sign in to comment.