1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:24:57 +00:00

ping: Replace two magic numbers with ICMP_* macros

This commit is contained in:
Linus Groh 2021-02-08 19:26:11 +01:00 committed by Andreas Kling
parent 2b03e95354
commit 22c6783db2

View file

@ -157,7 +157,7 @@ int main(int argc, char** argv)
PingPacket ping_packet;
memset(&ping_packet, 0, sizeof(PingPacket));
ping_packet.header.type = 8; // Echo request
ping_packet.header.type = ICMP_ECHO;
ping_packet.header.code = 0;
ping_packet.header.un.echo.id = htons(pid);
ping_packet.header.un.echo.sequence = htons(seq++);
@ -192,7 +192,7 @@ int main(int argc, char** argv)
return 1;
}
if (pong_packet.header.type != 0)
if (pong_packet.header.type != ICMP_ECHOREPLY)
continue;
if (pong_packet.header.code != 0)
continue;