Skip to contentSkip to conversation

net: sctp: bug-fixing: retran_path not set properly after transports recovering (v2)

PATCH In review Chang Xiangzhong 2 participants 2 messages Nov 13, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: sctp: bug-fixing: retran_path not set properly after transports recovering (v2)

When a transport recovers due to the new coming sack, SCTP should iterate all of its transport_list to locate the __two__ most recently used transport and set to active_path and retran_path respectively. The exising code does not find the two properly - In case of the following list:

[most-recent] -> [2nd-most-recent] -> ...

Both active_path and retran_path would be set to the 1st element.

The bug happens when:
1) multi-homing
2) failure/partial_failure transport recovers
Both active_path and retran_path would be set to the same most-recent one, in other words, retran_path would not take its role - an end user might not even notice this issue.

---
 net/sctp/associola.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
net/sctp/associola.c +5 -2
index ab67efc..a7fc856 100644
@@ -913,11 +913,12 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
 		if (!first || t->last_time_heard > first->last_time_heard) {
 			second = first;
 			first = t;
-		}
-		if (!second || t->last_time_heard > second->last_time_heard)
+		} else if (!second ||
+				t->last_time_heard > second->last_time_heard)
 			second = t;
 	}
 
+
 	/* RFC 2960 6.4 Multi-Homed SCTP Endpoints
 	 *
 	 * By default, an endpoint should always transmit to the
@@ -935,6 +936,8 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
 		first = asoc->peer.primary_path;
 	}
 
+	if (!second)
+		second = first;
 	/* If we failed to find a usable transport, just camp on the
 	 * primary, even if it is inactive.
 	 */
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 26 lines · Chang Xiangzhong

When a transport recovers due to the new coming sack, SCTP should iterate all of its transport_list to locate the __two__ most recently used transport and set to active_path and retran_path respectively. The exising code does not find the two properly - In case of the following list:

[most-recent] -> [2nd-most-recent] -> ...

Both active_path and retran_path would be set to the 1st element.

The bug happens when:
1) multi-homing
2) failure/partial_failure transport recovers
Both active_path and retran_path would be set to the same most-recent one, in other words, retran_path would not take its role - an end user might not even notice this issue.

---
  net/sctp/associola.c |    7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)
net/sctp/associola.c +0 -0
index ab67efc..a7fc856 100644

net/sctp/associola.c void sctp_assoc_control_transport(struct sctp_association *asoc, · line 917

Quoted 7 lines
net/sctp/associola.c +2 -2
@@ -913,11 +913,12 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
  		if (!first || t->last_time_heard > first->last_time_heard) {
  			second = first;
  			first = t;
-		}
-		if (!second || t->last_time_heard > second->last_time_heard)
+		} else if (!second ||
+				t->last_time_heard > second->last_time_heard)

Align with !second.

net/sctp/associola.c void sctp_assoc_control_transport(struct sctp_association *asoc, · line 921

Quoted 4 lines
net/sctp/associola.c +1 -0
  			second = t;
  	}
 
+

Spurious new line.

-vlad

Quoted 13 lines
net/sctp/associola.c +2 -0
  	/* RFC 2960 6.4 Multi-Homed SCTP Endpoints
  	 *
  	 * By default, an endpoint should always transmit to the
@@ -935,6 +936,8 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
  		first = asoc->peer.primary_path;
  	}
 
+	if (!second)
+		second = first;
  	/* If we failed to find a usable transport, just camp on the
  	 * primary, even if it is inactive.
  	 */