25.6. Protocol InitializationThe ICMPv4 protocol is initialized with icmp_init in net/ipv4/icmp.c. The ICMP protocol cannot be compiled as a module, so there is no module_init or module_cleanup function. The meaning of the _ _init macro tagging icmp_init can be found in Chapter 7. Initialization consists of the creation of an array of sockets, one per CPU, which will be used when transmitting ICMP messages generated by the kernel (as opposed to user-generated messages). Those sockets, of type SOCK_RAW and protocol IPPROTO_ICMP, are not to be inserted into the kernel socket's table because they are not supposed to be used as targets for ingress ICMP messages. For this reason, a call to the unhash function takes the sockets out of the hash tables where they have been added by the generic routine sock_create_kern.
uc_ttl, the TTL value to use for IP packets sent to unicast addresses, is initialized to -1 to tell the kernel to use the default unicast TTL (sysctl_ip_default_ttl). The setting of IP_PMTUDISC_DONT disables PMTU discovery on the sockets. The per-CPU sockets can be accessed with the icmp_socket macro defined in net/ipv4/icmp.c, which transparently selects the right socket based on the local CPU ID.
|
Wednesday, October 28, 2009
Section 25.6. Protocol Initialization
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment