[ Team LiB ] Previous Section Next Section

18.7 Summary

The last socket address structure that we encounter in this text is the sockaddr_dl structure, the variable-length datalink socket address structure. Berkeley-derived kernels associate these with interfaces, returning the interface index, name, and hardware address in one of these structures.

Five types of messages can be written to a routing socket by a process and 15 different messages can be returned by the kernel asynchronously on a routing socket. We showed an example where the process asks the kernel for information on a routing table entry and the kernel responds with all the details. These kernel responses contain up to eight socket address structures and we have to parse this message to obtain each piece of information.

The sysctl function is a general way to fetch and store OS parameters. The information we are interested in with sysctl is

  • Dumping the interface list

  • Dumping the routing table

  • Dumping the ARP cache

The changes required by IPv6 to the sockets API include four functions to map between interface names and their indexes. Each interface is assigned a unique positive index. Berkeley-derived implementations already associate an index with each interface, so we are easily able to implement these functions using sysctl.

    [ Team LiB ] Previous Section Next Section