Chapter 32. Raw IP

32.1. Introduction

A process accesses the raw IP layer by creating a socket of type SOCK_RAW in the Internet domain. There are three uses for raw sockets:

1. Raw sockets allow a process to send and receive ICMP and IGMP messages.

The Ping program uses this type of socket to send ICMP echo requests and to receive ICMP echo replies.

Some routing daemons use this feature to track ICMP redirects that are processed by the kernel. We saw in Section 19.7 that Net/3 generates an RTM_REDIRECT message on a routing socket when a redirect is processed, obviating the need for this use of raw sockets.

This feature is also used to implement protocols based on ICMP, such as router advertisement and router solicitation ...

Get TCP/IP Illustrated now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.