L4 Protocol Registration
The L4 protocols that rest on IPv4 are defined by net_protocol data structures, defined in include/net/protocol.h, which consist of the following three
fields:
-
int (*handler)(struct sk_buff *skb) Function registered by the protocol as the handler for incoming packets. This is discussed further in the section "L3 to L4 Delivery: ip_local_deliver_finish." It is possible to have protocols that share the same handler for both IPv4 and IPv6 (e.g., SCTP).
-
void (*err_handler)(struct sk_buff *skb, u32 info) Function used by the ICMP protocol handler to inform the L4 protocol about the reception of an ICMP UNREACHABLE message. We will see in Chapter 35 when a Linux system generates ICMP UNREACHABLE messages, and we will see in Chapter 25 how the ICMP protocol uses
err_handler.-
int no_policy This field is consulted at certain key points in the network stack and is used to exempt protocols from IPsec policy checks: 1 means that there is no need to check the IPsec policies for the protocol. Do not confuse the
no_policyfield of thenet_protocolstructure with the field bearing the same name in theipv4_devconfstructure: the former applies to a protocol; the latter applies to a device. See the sections "L3 to L4 Delivery: ip_local_deliver_finish" and "IPsec" for howno_policyis used.
The include/linux/in.h file contains a list of L4
protocols defined as IPPROTO_
XXX symbols. (For a more complete list, see the /etc/protocols file, or RFC 1700 and its successor RFCs.) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access