Chapter 20. Routing Sockets


A process sends and receives the routing messages described in the previous chapter by using a socket in the routing domain. The socket system call is issued specifying a family of PF_ROUTE and a socket type of SOCK_RAW.

The process can then send five routing messages to the kernel:

  1. RTM_ADD: add a new route.

  2. RTM_DELETE: delete an existing route.

  3. RTM_GET: fetch all the information about a route.

  4. RTM_CHANGE: change the gateway, interface, or metrics of an existing route.

  5. RTM_LOCK: specify which metrics the kernel should not modify.

Additionally, the process can receive any of the other seven types of routing messages that are generated by the kernel when some event, such as interface down, redirect received, etc., ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.