4. Packet Processing
4. Packet Processing
This section describes SRv6 packet processing at the SR source, Transit, and SR segment endpoint nodes.
4.1. SR Source Node
A source node steers a packet into an SR Policy. If the SR Policy results in a Segment List containing a single segment, and there is no need to add information to the SRH flag or add TLV; the DA is set to the single Segment List entry, and the SRH MAY be omitted.
When needed, the SRH is created as follows:
The Next Header and Hdr Ext Len fields are set as specified in [RFC8200].
The Routing Type field is set to 4.
The DA of the packet is set with the value of the first segment.
The first element of the SRH Segment List is the ultimate segment. The second element is the penultimate segment, and so on.
The Segments Left field is set to n-1, where n is the number of elements in the SR Policy.
The Last Entry field is set to n-1, where n is the number of elements in the SR Policy.
TLVs (including HMAC) may be set according to their specification.
The packet is forwarded toward the packet's Destination Address (the first segment).
4.1.1. Reduced SRH
When a source does not require the entire SID list to be preserved in the SRH, a reduced SRH may be used.
A reduced SRH does not contain the first segment of the related SR Policy (the first segment is the one already in the DA of the IPv6 header), and the Last Entry field is set to n-2, where n is the number of elements in the SR Policy.
4.2. Transit Node
As specified in [RFC8200], the only node allowed to inspect the Routing Extension Header (and therefore the SRH) is the node corresponding to the DA of the packet. Any other transit node MUST NOT inspect the underneath routing header and MUST forward the packet toward the DA according to its IPv6 routing table.
When a SID is in the destination address of an IPv6 header of a packet, it's routed through an IPv6 network as an IPv6 address. SIDs, or the prefix(es) covering SIDs, and their reachability may be distributed by means outside the scope of this document. For example, [RFC5308] or [RFC5340] may be used to advertise a prefix covering the SIDs on a node.
4.3. SR Segment Endpoint Node
Without constraining the details of an implementation, the SR segment endpoint node creates Forwarding Information Base (FIB) entries for its local SIDs.
When an SRv6-capable node receives an IPv6 packet, it performs a longest-prefix-match lookup on the packet's destination address. This lookup can return any of the following:
-
A FIB entry that represents a locally instantiated SRv6 SID
-
A FIB entry that represents a local interface, not locally instantiated as an SRv6 SID
-
A FIB entry that represents a nonlocal route
-
No Match
4.3.1. FIB Entry Is a Locally Instantiated SRv6 SID
This document and section define a single SRv6 SID. Future documents may define additional SRv6 SIDs. In such a case, the entire content of this section will be defined in that document.
If the FIB entry represents a locally instantiated SRv6 SID, process the next header chain of the IPv6 header as defined in Section 4 of [RFC8200]. Section 4.3.1.1 describes how to process an SRH; Section 4.3.1.2 describes how to process an upper-layer header or the absence of a Next Header.
Processing this SID modifies the Segments Left and, if configured to process TLVs, it may modify the "variable-length data" of TLV types that change en route. Therefore, Segments Left is mutable, and TLVs that change en route are mutable. The remainder of the SRH (Flags, Tag, Segment List, and TLVs that do not change en route) are immutable while processing this SID.
4.3.1.1. SRH Processing
S01. When an SRH is processed {
S02. If Segments Left is equal to zero {
S03. Proceed to process the next header in the packet,
whose type is identified by the Next Header field in
the routing header.
S04. }
S05. Else {
S06. If local configuration requires TLV processing {
S07. Perform TLV processing (see TLV Processing)
S08. }
S09. max_last_entry = ( Hdr Ext Len / 2 ) - 1
S10. If ((Last Entry > max_last_entry) or
S11. (Segments Left is greater than (Last Entry+1)) {
S12. Send an ICMP Parameter Problem, Code 0, message to
the Source Address, pointing to the Segments Left
field, and discard the packet.
S13. }
S14. Else {
S15. Decrement Segments Left by 1.
S16. Copy Segment List[Segments Left] from the SRH to the
destination address of the IPv6 header.
S17. If the IPv6 Hop Limit is less than or equal to 1 {
S18. Send an ICMP Time Exceeded -- Hop Limit Exceeded in
Transit message to the Source Address and discard
the packet.
S19. }
S20. Else {
S21. Decrement the Hop Limit by 1
S22. Resubmit the packet to the IPv6 module for transmission
to the new destination.
S23. }
S24. }
S25. }
S26. }
4.3.1.1.1. TLV Processing
Local configuration determines how TLVs are to be processed when the Active Segment is a local SID defined in this document. The definition of local configuration is outside the scope of this document.
For illustration purposes only, two example local configurations that may be associated with a SID are provided below.
Example 1: For any packet received from interface I2 Skip TLV processing
Example 2: For any packet received from interface I1 If first TLV is HMAC { Process the HMAC TLV } Else { Discard the packet }
4.3.1.2. Upper-Layer Header or No Next Header
When processing the upper-layer header of a packet matching a FIB entry locally instantiated as an SRv6 SID defined in this document:
IF (Upper-layer Header is IPv4 or IPv6) and
local configuration permits {
Perform IPv6 decapsulation
Resubmit the decapsulated packet to the IPv4 or IPv6 module
}
ELSE {
Send an ICMP parameter problem message to the Source Address and
discard the packet. Error code (4) "SR Upper-layer
Header Error", pointer set to the offset of the upper-layer
header.
}
A unique error code allows an SR source node to recognize an error in SID processing at an endpoint.
4.3.2. FIB Entry Is a Local Interface
If the FIB entry represents a local interface and is not locally instantiated as an SRv6 SID, the SRH is processed as follows:
If Segments Left is zero, the node must ignore the routing header and proceed to process the next header in the packet, whose type is identified by the Next Header field in the routing header.
If Segments Left is non-zero, the node must discard the packet and send an ICMP Parameter Problem, Code 0, message to the packet's Source Address, pointing to the unrecognized Routing Type.
4.3.3. FIB Entry Is a Nonlocal Route
Processing is not changed by this document.
4.3.4. FIB Entry Is a No Match
Processing is not changed by this document.