Master the fundamental concepts of network stack fundamentals through this focused micro-challenge.
UDP is connectionless with just four fields. For example, a DNS query to 8.8.8.8 uses destination port 53, source port some ephemeral value like 49152, length covering header plus query data, and an optional checksum.
cLoading…
ICMP sits directly on IP (protocol 1) with no port numbers. Instead it uses type and code:
8, code 0: Echo Request (ping)0, code 0: Echo Reply11, code 0: Time Exceeded (traceroute)Echo requests add a 16-bit identifier and 16-bit sequence number after the checksum, plus optional payload data echoed back in the reply.
This task requires you to parse simulated UDP and ICMP packets. DNS resolvers and every ping utility on Linux depend on exactly these two lightweight formats, and you will craft raw ICMP echo requests in the next subtrack.
Write a C program that parses simulated UDP and ICMP packets. Print UDP ports and length. Print ICMP type, code, id, and sequence.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github