cnping

Minimal Graphical Ping Tool
git clone https://git.sinitax.com/cnlohr/cnping
Log | Files | Refs | Submodules | README | LICENSE | sfeed.txt

commit bbb22884736fe85da757ef767a31de26dfaaf7c0
parent edb0739883edd8687448b682784f8aface4bddf9
Author: Michael Buch <michaelbuch12@gmail.com>
Date:   Mon, 25 Mar 2019 16:06:20 +0000

Fix up offset to check for magic number on receive of a packet according to FreeBSDs size of struct icmp

Diffstat:
Mping.c | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/ping.c b/ping.c @@ -139,8 +139,14 @@ void listener() if( buf[9] != 1 ) continue; //ICMP if( addr.sin_addr.s_addr != psaddr.sin_addr.s_addr ) continue; + // sizeof(packet.hdr) + 20 +#ifdef __FreeBSD__ + int offset = 48; +#else + int offset = 28; +#endif if ( bytes > 0 ) - display(buf + 28, bytes - 28 ); + display(buf + offset, bytes - offset ); else { ERRM("Error: recvfrom failed");