The Routing Header, identified by a Next Header value of 43 in the header immediately preceding it, allows an IPv6 source to determine routes to reach its destination by listing one or more intermediate nodes to be visited. (This is very similar to IPv4’s Loose Source and Record Route options.) The format of the Routing Header is shown in Figure 3.7.
When a node encounters an unrecognized Routing Type, and the value of
segment left is zero, it ignores the Routing header and continues to process the
next header. However, if Segment Left is not zero, a node discards the packet and sends an ICMP Parameter Problem, Code 0, message to the packet’s Source Address. Currently, only Type 0 has been defined; Figure 3.8 shows the format of a Type 0 Routing header.
One application of the Type 0 Routing header is in supporting new proto- cols, such as RSVP.
The IPv6 Headers • Chapter 3 95
www.syngress.com
Figure 3.7 Routing Header
variable type-specific data variable length Next Header 8 bits Hdr Ext Len 8 bits
Next Header 8-bit selector. Identifies the type of header immediately following the Routing header. Uses the same values as the IPv4 Protocol field [RFC-1700]. Hdr Ext Len 8-bit unsigned integer. Length of the Routing header in 8-octet units, not
including the first 8 octets.
Routing Type 8-bit identifier of a particular Routing header variant.
Segments Left 8-bit unsigned integer. Number of route segments remaining, i.e., number of explicitly listed intermediate nodes still to be visited before reaching the final destination.
type-specific data Variable-length field, of format determined by the Routing Type, and of length such that the complete Routing header is complete Routing header is an integer multiple of 8 octets. Routing Type 8 bits Segments Left 8 bits 32 bits 1 8 16 24 32
Figure 3.8 Type 0 Routing Header
24 octets
Reserved Next Header Hdr Ext Len
Next Header 8-bit selector. Identifies the type of header immediately following the Routing header. Uses the same values as the IPv4 Protocol field [RFC-1700]. Hdr Ext Len 8-bit unsigned integer. Length of the Routing header in 8-octet units, not
including the first 8 octets. For the Type 0 Routing header, Hdr Ext Length is equal to two times the number of addresses in the header. Routing Type 0
Segments Left 8-bit unsigned integer. Number of route segments remaining, i.e., number of explicitly listed intermediate nodes still to be visited before reaching the final destination.
Reserved 32-bit reserved field. Initialized to zero for transmission; ignored on reception. Address[1...n] Vector of 128-bit addresses, numbered 1 to n.
Routing Type Segments Left
Address[1]
Address[n]
16 octets
32 bits
96 Chapter 3 • The IPv6 Headers
In RSVP, a connection path may be established whereby all packets
belonging to that connection follow the same path to reach the destination.The source of this connection may then use a Type 0 Routing header to specify the path to its destination.
Another use of a Routing header is to communicate with a mobile node away from its home network without triangle routing.Without Route
Optimization, which may or may not be supported, packets may have to be sent to the mobile node’s home network and be forwarded by the home agent (cre- ating triangle routing) when a mobile node is away from its home network.The source of such a connection can specify the path using a Type 0 Routing header in order to allow the source of a connection to specify its path and avoid triangle routing.
For the connection between source node s and destination node d via routers
r1 and r2, source node s creates an IPv6 packet with a routing header, as shown
in Figure 3.9(a). Notice that the destination field is r1, the first router in the path, rather than the final destination node d. Recall that except for the Hop-by-Hop Options header, all other extension headers are examined only by the packet’s destination node. Since router r1 is the destination of this packet, after examining the IPv6 header, it will continue to process the next header as indicated by the
Next Header field. In this case, the Routing header will be processed by router r1.
The extension header length field has a value of four, indicating that the length of the Routing header is four 8-octet sets, not counting the first eight octets.The value of four is also twice the number of addresses in this Routing header (two, as indicated in the segments left field).The first address in the Routing header is the next router in the path, r2, followed by the final destination node d.
Router r1 decrements the segments left field and swaps the values of the desti-
nation field in the IPv6 header and the first address in the Routing header. Figure
3.9 (b) shows the packet sent from router r1 to router r2. Similarly, after exam- ining the IPv6 header, router r2 continues to process the Routing header, since the destination field of the IPv6 header is r2. Again, router r2 decrements the seg-
ment left field and swaps the values in the destination field of the IPv6 header and
the second address in the Routing header, as shown in Figure 3.9(c).When pro- cessing the Routing header, the index of the address to visit can be computed using the header extension length and the segment left fields:
The IPv6 Headers • Chapter 3 97 When the Segment Left value reaches zero, the node handling this Routing
header proceeds to process the next header in the packet, whose type is identified in the next header field in the Routing header.
N
OTEThe Type 0 Routing header is processed by all nodes appearing in the
address field, and each node decrements the segment left field and
swaps the values in the destination field in the IPv6 node and the
address. Thus, multicast addresses must not appear in the address of the Type 0 Routing header or in the IPv6 destination field of a packet con- taining the Routing header.
When processing the Type 0 Routing header, format checking is performed. Recall that the Header Extension length is two times the number of addresses in the Routing header.Thus, the Header Extension length must not be odd. A node processing this packet discards the packet and sends an ICMP Parameter Problem, Code 0, message to the source node. Since the Header Extension length is two
www.syngress.com
Figure 3.9 Packets with a Routing Header
data d r1 0 r2 s 6 43 upper-layer protocol header data d r2 0 6 4 0 2 r1 s 6 43 data r2 r1 0 d s 6 43 (a) between s and r1 (b) between r1 and r2 (c) between r2 and d r2 s d r1 upper-layer protocol header upper-layer protocol header 6 4 0 0 6 4 0 1
98 Chapter 3 • The IPv6 Headers
times the number of addresses in the Routing header, the largest value in the
segment left field cannot be more than half of the Header Extension length. If the
Segment Left value is larger, the node handling the packet also discards this packet and sends an ICMP Parameter Problem, Code 0, message to the source.
Fragment Header
The 16-bit total length field in the IPv4 header limits the maximum size of a packet to be 64k bytes. However, depending on the link technology used, the actual size of a packet may be further limited. In IPv4 packet transmission, each IP layer is
responsible for fragmenting packets, if necessary, to ensure that the packet size does not exceed the maximum transmission unit.Thus, the user data sent in a single packet from a source node may arrive at the destination node in multiple packets if there is a link whose MTU is smaller than the link MTU at the source node.This approach, however, may not be the most optimal solution for the path.