28.8 Summary
Raw sockets provide three capabilities:
-
We can read and write ICMPv4, IGMPv4, and ICMPv6
packets.
-
We can read and write IP datagrams with a
protocol field that the kernel does not handle.
-
We can build our own IPv4 header, normally used
for diagnostic purposes (or by hackers, unfortunately).
Two commonly used diagnostic tools,
ping and traceroute, use raw sockets, and we have
developed our own versions of both that support IPv4 and IPv6. We
also developed our own icmpd daemon that provides access
to ICMP errors for a UDP socket. This example also provided an
example of descriptor passing across a Unix domain socket between
an unrelated client and server.
|