To make a more flexibility decision on path selection, we should classified all the available interfaces into several classes. We define each class by the service type, the link cost, and the reachable destination networks. Table 4.2 is an example.
In table 4.2, the interfaces LAN0, LAN1, W LAN0 and W LAN1 allow all connections from all applications to all destination networks. Since the network speed of LAN0and W LAN0aenr not the same, they are in different service class.
The W LAN2 is only used to connect to a private network ”10.0.0.0/8.” A dial-up link DialU p0 can only allow the web, telnet, and mail service to connect to the
Table 4.2: Service Classes
0 LAN0 All 0.0.0.0
LAN1
1 W LAN0 All 0.0.0.0
W LAN1
2 W LAN2 All 10.0.0.0/8
3 DialU p0 HTTP, Telnet, SMTP 140.113.0.0/16
4 GP RS0 SMTP 0.0.0.0
GP RS1
network ”140.113.0.0/16”. The GP RS0 and GP RS1 links are only allowed mail connections.
The lower class number has the higher priority to be select as candidate net-work interfaces. Each interface can be appeared in more than one service classes.
4.2.1 Primary path selection algorithm
Before an SCTP association starts to send packet, the primary and alternative in-terface should be chosen. This task was done by the following two algorithms: the Primary Path Selection Algorithm and the AlternativePath Selection Algorithm.
To select the primary path, we should first get all the available paths according to the destination addresses and the service type, by using the getP athSet(dest, service) function.
After getting all the available paths, the priority of each path is calculated and compared to select the maximum. The priority of a specific path is defined by γ · min(Cwinth/RT T, Ri) · (1 − ErrorRatei)/Costi. The value Cwin − threshold/RT T is the available sending-speed of a particular network interface.
We make the link cost Costi and the error rate ErrorRatei into consideration.
A path i that was previous marked as failed will never be take into consideration.
However, after receiving a heartbeat message from this path will mark it as an active path again.
The primary path selection algorithm is shown in Algorithm 2.
Algorithm 2 Primary Path Selection P athSet = getP athSet(dest, service);
Candidate = 0;
for all i in PathSet do if i is mark as failed then
P riorityi = 0 else
P riorityi = γ · min(Cwinth/RT T, Ri) · (1 − ErrorRatei)/Costi; end if
if P riorityi > P rioritycandidatethen Candidate = i;
end if end for
ActiveP ath = i;
return Candidate;
4.2.2 Alternative path selection algorithm
After selecting the primary path, the alternative path is selected with a lower pri-ority than the primary path, as shown in Algorithm 3. The alternative path will not be the same as the current ActiveP ath (the path that is used to sending packet).
The alternative path selection algorithm is to select a backup link of the current active path. The active path may not be the primary path.
Algorithm 3 Alternative Path Selection P athSet = getP athSet(dest, service);
if ActiveP ath == 0 then if i is marked as failed then
P riorityi = 0;
else
P riorityi = γ · min(Cwndth/RT T, Ri) · (1 − ErrorRatei)/Costi; end if
if (P riorityi > P rioritycandidate) and (i! = ActiveP ath) then Candidate = i;
end if end for return i;
4.2.3 Temporary failover algorithm
If a packet is sent to the destination address but the acknowledgment packet is not received before time RT O, the traffic should be in the following conditions:
Congestion There are network congestion between two endpoints. The transmis-sion speed is reduced but the endpoint is still available.
Temporary failure The network was down due to unknown reasons for a short time. The link may be up again before the connection is terminated.
Permanent failure The network was down due to unknown reasons, but the link cannot be recovered before the connection is terminated.
SCTP uses same congestion control algorithm in TCP. If a network conges-tion is occurred, which means the acknowledgment packet does not arrived on
time, the congestion windows size Cwnd will be reduced. That is, if we do not received the acknowledgment packet at the first time, we will treat this condition as a congestion.
At this time, the packets without acknowledgment will be sent to an alternative path and the timeout value RT Oi of the primary path will be doubled, whereby the transmission speed between two endpoints will be reduced. The following packets, will be still send to the primary path instead of the alternative path.
In the worst case, if the timeout value RT Oi of the primary destination ad-dress is doubled several times until reach the maximum value RT OM AX but the acknowledgment packets are still not received, we mark the link as temporary failure.
In this following algorithm, we use a threshold counter tCounter to deter-minate where a path is temporary disabled if the Retransi of the primary path reaches the threshold value of tCounter. The tCounter is adjustable from 2 to RetransM AX.
The ActiveP ath will be changed from the primary path to an alternative path temporary if any error occurred. Another path used for backup will be selected by the algorithm AlternativeP athSelection, as shown in figure 3. In the same time, a heartbeat message will be sent to the primary path and wait for the response. If the heartbeat acknowledgment (HBACK) packet is received, the ActiveP ath will be changed back to the primary path.
The temporary failover algorithm is described in Algorithm 4.
Algorithm 4 Temporary Failover
P rimaryP ath = ActiveP ath = P rimaryP athSelection(dest, service);
AlternativeP ath = AlternativeP athSelection(dest, service, ActiveP ath);
Send packets to ActiveP ath;
start timer;
if timer reaches RT Oi then RT Oi = 2 · RT Oi;
if RT Oi > RT OM AX then RT Oi= RT OM AX; end if
Send non ACK packets to AlternativeP ath;
Send HB packet to P rimaryP ath;
Retransi++;
if Retransi >= tCounter then ActiveP ath = AlternativeP ath;
AlternativeP ath = AlternativeP athSelection(dest, service, ActiveP ath);
end if end if
if get HBACK from P rimaryP ath then AlternativeP ath = ActiveP ath;
ActiveP ath = P rimaryP ath;
end if
4.2.4 Long-term failover algorithm
In the temporary failover algorithm, the data packets will be sent to the alternative address, but the condition of primary destination address is still monitored by sending the heartbeat message continuously and wait for the response.
If the HBACKis still not received in time, the retransmission counter Retransi
of the primary destination address will be increased and the RT Oi will be dou-bled each time until a maximum value (RT OM AX) is reached. The default value of RT OM AX is 60 seconds in SCTP protocol. After a specific period, where the re-transmission counter reaches RetransM AX, the primary path will be marked as failed. In this condition, the alternative path becomes the new primary path
and another candidate alternative path is selected from the available PathSet. The long-term failover algorithm is shown in Algorithm 5.
Algorithm 5 Long-term Failover if timer reaches RT Oi then
RT Oi= 2 * RT Oi;
if RT Oi > RT OM AX then RT Oi= RT OM AX; end if
Send non-ACK packets to AlternativeP ath;
Send HB packet to P rimaryP ath;
Retransi++;
if Retransi >= tCounter then ActiveP ath = AlternativeP ath;
AlternativeP ath = AlternativeP athSelection(dest, service, ActiveP ath);
end if
if Retransi >= RetransM AX and get no HBACK from P rimaryP ath then
Mark P rimaryP ath as failed;
P rimaryP ath = ActiveP ath;
end if end if
if get HBACK from P rimaryP ath then AlternativeP ath = ActiveP ath;
ActiveP ath = P rimaryP ath;
Retransi–;
end if