diff options
author | Wei Yongjun <yjwei@cn.fujitsu.com> | 2009-05-12 09:52:51 -0400 |
---|---|---|
committer | Vlad Yasevich <vladislav.yasevich@hp.com> | 2009-06-03 09:14:46 -0400 |
commit | 9919b455fc00c995ef8141848bdc0709ce50bf36 (patch) | |
tree | ec700e8a9fe3dd9f1ed841e22f96c06476d484fb /net/sctp/associola.c | |
parent | d48e074dfdada552fa53f5eab807540f352e0d5d (diff) |
sctp: fix to choose alternate destination when retransmit ASCONF chunk
RFC 5061 Section 5.1 ASCONF Chunk Procedures said:
B4) Re-transmit the ASCONF Chunk last sent and if possible choose an
alternate destination address (please refer to [RFC4960],
Section 6.4.1). An endpoint MUST NOT add new parameters to this
chunk; it MUST be the same (including its Sequence Number) as
the last ASCONF sent. An endpoint MAY, however, bundle an
additional ASCONF with new ASCONF parameters with the next
Sequence Number. For details, see Section 5.5.
This patch fix to choose an alternate destination address when
re-transmit the ASCONF chunk, with some dup codes cleanup.
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Diffstat (limited to 'net/sctp/associola.c')
-rw-r--r-- | net/sctp/associola.c | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 8d3aef9d0615..39f5166ae7af 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
@@ -1284,49 +1284,21 @@ void sctp_assoc_update_retran_path(struct sctp_association *asoc) | |||
1284 | ntohs(t->ipaddr.v4.sin_port)); | 1284 | ntohs(t->ipaddr.v4.sin_port)); |
1285 | } | 1285 | } |
1286 | 1286 | ||
1287 | /* Choose the transport for sending a INIT packet. */ | 1287 | /* Choose the transport for sending retransmit packet. */ |
1288 | struct sctp_transport *sctp_assoc_choose_init_transport( | 1288 | struct sctp_transport *sctp_assoc_choose_alter_transport( |
1289 | struct sctp_association *asoc) | 1289 | struct sctp_association *asoc, struct sctp_transport *last_sent_to) |
1290 | { | 1290 | { |
1291 | struct sctp_transport *t; | 1291 | /* If this is the first time packet is sent, use the active path, |
1292 | 1292 | * else use the retran path. If the last packet was sent over the | |
1293 | /* Use the retran path. If the last INIT was sent over the | ||
1294 | * retran path, update the retran path and use it. | 1293 | * retran path, update the retran path and use it. |
1295 | */ | 1294 | */ |
1296 | if (!asoc->init_last_sent_to) { | 1295 | if (!last_sent_to) |
1297 | t = asoc->peer.active_path; | ||
1298 | } else { | ||
1299 | if (asoc->init_last_sent_to == asoc->peer.retran_path) | ||
1300 | sctp_assoc_update_retran_path(asoc); | ||
1301 | t = asoc->peer.retran_path; | ||
1302 | } | ||
1303 | |||
1304 | SCTP_DEBUG_PRINTK_IPADDR("sctp_assoc_update_retran_path:association" | ||
1305 | " %p addr: ", | ||
1306 | " port: %d\n", | ||
1307 | asoc, | ||
1308 | (&t->ipaddr), | ||
1309 | ntohs(t->ipaddr.v4.sin_port)); | ||
1310 | |||
1311 | return t; | ||
1312 | } | ||
1313 | |||
1314 | /* Choose the transport for sending a SHUTDOWN packet. */ | ||
1315 | struct sctp_transport *sctp_assoc_choose_shutdown_transport( | ||
1316 | struct sctp_association *asoc) | ||
1317 | { | ||
1318 | /* If this is the first time SHUTDOWN is sent, use the active path, | ||
1319 | * else use the retran path. If the last SHUTDOWN was sent over the | ||
1320 | * retran path, update the retran path and use it. | ||
1321 | */ | ||
1322 | if (!asoc->shutdown_last_sent_to) | ||
1323 | return asoc->peer.active_path; | 1296 | return asoc->peer.active_path; |
1324 | else { | 1297 | else { |
1325 | if (asoc->shutdown_last_sent_to == asoc->peer.retran_path) | 1298 | if (last_sent_to == asoc->peer.retran_path) |
1326 | sctp_assoc_update_retran_path(asoc); | 1299 | sctp_assoc_update_retran_path(asoc); |
1327 | return asoc->peer.retran_path; | 1300 | return asoc->peer.retran_path; |
1328 | } | 1301 | } |
1329 | |||
1330 | } | 1302 | } |
1331 | 1303 | ||
1332 | /* Update the association's pmtu and frag_point by going through all the | 1304 | /* Update the association's pmtu and frag_point by going through all the |