Passa al contenuto principale

4.4 Routing Header (Intestazione di routing)

La Routing header viene usata da una sorgente IPv6 per elencare uno o più nodi intermedi da visitare lungo il percorso verso la destinazione del pacchetto. Questa funzione è molto simile alla Loose Source and Record Route option (opzione Loose Source and Record Route) di IPv4. La Routing header è identificata dal valore 43 di Next Header nell'intestazione immediatamente precedente e ha il formato seguente:

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Hdr Ext Len | Routing Type | Segments Left |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
. .
. type-specific data .
. .
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Next Header (intestazione successiva) - Selettore a 8 bit. Identifica il tipo di intestazione che segue immediatamente la Routing header. Usa gli stessi valori del campo IPv4 Protocol [RFC-1700 et seq.].

Hdr Ext Len (lunghezza dell'estensione di intestazione) - Intero senza segno a 8 bit. Lunghezza della Routing header in unità di 8 ottetti, esclusi i primi 8 ottetti.

Routing Type (tipo di routing) - Identificatore a 8 bit di una particolare variante della Routing header.

Segments Left (segmenti rimanenti) - Intero senza segno a 8 bit. Numero di segmenti di route rimanenti, cioè il numero di nodi intermedi esplicitamente elencati ancora da visitare prima di raggiungere la destinazione finale.

type-specific data (dati specifici del tipo) - Campo di lunghezza variabile, il cui formato è determinato da Routing Type, con lunghezza tale che la lunghezza completa della Routing header sia un multiplo intero di 8 ottetti.

Se, durante l'elaborazione di un pacchetto ricevuto, un nodo incontra una Routing header con un valore Routing Type non riconosciuto, il comportamento richiesto del nodo dipende dal valore del campo Segments Left, come segue:

Se Segments Left è zero, il nodo deve ignorare la Routing header e continuare l'elaborazione dell'intestazione successiva nel pacchetto, il cui tipo è identificato dal campo Next Header nella Routing header.

Se Segments Left è diverso da zero, il nodo deve scartare il pacchetto e inviare al Source Address del pacchetto un messaggio ICMP Parameter Problem, Code 0, che punta al Routing Type non riconosciuto.

Se, dopo aver elaborato la Routing header di un pacchetto ricevuto, un nodo intermedio determina che il pacchetto sarà inoltrato su un link la cui MTU è inferiore alla dimensione del pacchetto, il nodo deve scartare il pacchetto e inviare al Source Address del pacchetto un messaggio ICMP Packet Too Big.

Type 0 Routing header (Intestazione di routing di tipo 0)

La Type 0 Routing header ha il formato seguente:

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Hdr Ext Len | Routing Type=0| Segments Left |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Reserved |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ +
| |
+ Address[1] +
| |
+ +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ +
| |
+ Address[2] +
| |
+ +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
. . .
. . .
. . .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+ +
| |
+ Address[n] +
| |
+ +
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Next Header (intestazione successiva) - Selettore a 8 bit. Identifica il tipo di intestazione che segue immediatamente la Routing header. Usa gli stessi valori del campo IPv4 Protocol [RFC-1700 et seq.].

Hdr Ext Len (lunghezza dell'estensione di intestazione) - Intero senza segno a 8 bit. Lunghezza della Routing header in unità di 8 ottetti, esclusi i primi 8 ottetti. Per una Type 0 Routing header, Hdr Ext Len è pari al doppio del numero di indirizzi presenti nell'intestazione.

Routing Type (tipo di routing) - 0.

Segments Left (segmenti rimanenti) - Intero senza segno a 8 bit. Numero di segmenti di route rimanenti, cioè il numero di nodi intermedi esplicitamente elencati ancora da visitare prima di raggiungere la destinazione finale.

Reserved (riservato) - Campo riservato a 32 bit. Inizializzato a zero alla trasmissione; ignorato alla ricezione.

Address[1..n] (indirizzo[1..n]) - Vettore di indirizzi a 128 bit, numerati da 1 a n.

Gli indirizzi multicast non devono comparire in una Type 0 Routing header, né nel campo IPv6 Destination Address di un pacchetto che trasporta una Type 0 Routing header.

La Routing header non viene esaminata o elaborata finché il pacchetto non raggiunge il nodo identificato nel campo Destination Address dell'intestazione IPv6. In quel nodo, la selezione basata sul campo Next Header dell'intestazione immediatamente precedente invoca il modulo Routing header, che nel caso di Routing Type 0 esegue l'algoritmo seguente:

if Segments Left = 0 {
proceed to process the next header in the packet, whose type is
identified by the Next Header field in the Routing header
}
else if Hdr Ext Len is odd {
send an ICMP Parameter Problem, Code 0, message to the Source
Address, pointing to the Hdr Ext Len field, and discard the
packet
}
else {
compute n, the number of addresses in the Routing header, by
dividing Hdr Ext Len by 2

if Segments Left is greater than n {
send an ICMP Parameter Problem, Code 0, message to the Source
Address, pointing to the Segments Left field, and discard the
packet
}
else {
decrement Segments Left by 1;
compute i, the index of the next address to be visited in
the address vector, by subtracting Segments Left from n

if Address [i] or the IPv6 Destination Address is multicast {
discard the packet
}
else {
swap the IPv6 Destination Address and Address[i]

if the IPv6 Hop Limit is less than or equal to 1 {
send an ICMP Time Exceeded -- Hop Limit Exceeded in
Transit message to the Source Address and discard the
packet
}
else {
decrement the Hop Limit by 1

resubmit the packet to the IPv6 module for transmission
to the new destination
}
}
}
}

Esempio di routing

Come esempio dell'effetto dell'algoritmo precedente, si consideri il caso in cui un nodo sorgente S invii un pacchetto a un nodo destinazione D, usando una Routing header per instradare il pacchetto attraverso i nodi intermedi I1, I2 e I3. Su ciascun segmento del percorso di consegna, i valori dei campi rilevanti dell'intestazione IPv6 e della Routing header saranno i seguenti:

Quando il pacchetto viene trasmesso da S a I1:

Source Address = S                  Hdr Ext Len = 6
Destination Address = I1 Segments Left = 3
Address[1] = I2
Address[2] = I3
Address[3] = D

Quando il pacchetto viene trasmesso da I1 a I2:

Source Address = S                  Hdr Ext Len = 6
Destination Address = I2 Segments Left = 2
Address[1] = I1
Address[2] = I3
Address[3] = D

Quando il pacchetto viene trasmesso da I2 a I3:

Source Address = S                  Hdr Ext Len = 6
Destination Address = I3 Segments Left = 1
Address[1] = I1
Address[2] = I2
Address[3] = D

Quando il pacchetto viene trasmesso da I3 a D:

Source Address = S                  Hdr Ext Len = 6
Destination Address = D Segments Left = 0
Address[1] = I1
Address[2] = I2
Address[3] = I3