diff options
Diffstat (limited to 'net/sctp/sm_sideeffect.c')
-rw-r--r-- | net/sctp/sm_sideeffect.c | 78 |
1 files changed, 44 insertions, 34 deletions
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index 9732c797e8ed..13d9eea5cf1a 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c | |||
@@ -889,6 +889,35 @@ static void sctp_cmd_adaptation_ind(sctp_cmd_seq_t *commands, | |||
889 | sctp_ulpq_tail_event(&asoc->ulpq, ev); | 889 | sctp_ulpq_tail_event(&asoc->ulpq, ev); |
890 | } | 890 | } |
891 | 891 | ||
892 | |||
893 | static void sctp_cmd_t1_timer_update(struct sctp_association *asoc, | ||
894 | sctp_event_timeout_t timer, | ||
895 | char *name) | ||
896 | { | ||
897 | struct sctp_transport *t; | ||
898 | |||
899 | t = asoc->init_last_sent_to; | ||
900 | asoc->init_err_counter++; | ||
901 | |||
902 | if (t->init_sent_count > (asoc->init_cycle + 1)) { | ||
903 | asoc->timeouts[timer] *= 2; | ||
904 | if (asoc->timeouts[timer] > asoc->max_init_timeo) { | ||
905 | asoc->timeouts[timer] = asoc->max_init_timeo; | ||
906 | } | ||
907 | asoc->init_cycle++; | ||
908 | SCTP_DEBUG_PRINTK( | ||
909 | "T1 %s Timeout adjustment" | ||
910 | " init_err_counter: %d" | ||
911 | " cycle: %d" | ||
912 | " timeout: %ld\n", | ||
913 | name, | ||
914 | asoc->init_err_counter, | ||
915 | asoc->init_cycle, | ||
916 | asoc->timeouts[timer]); | ||
917 | } | ||
918 | |||
919 | } | ||
920 | |||
892 | /* These three macros allow us to pull the debugging code out of the | 921 | /* These three macros allow us to pull the debugging code out of the |
893 | * main flow of sctp_do_sm() to keep attention focused on the real | 922 | * main flow of sctp_do_sm() to keep attention focused on the real |
894 | * functionality there. | 923 | * functionality there. |
@@ -1196,6 +1225,11 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | |||
1196 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, | 1225 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, |
1197 | SCTP_CHUNK(cmd->obj.ptr)); | 1226 | SCTP_CHUNK(cmd->obj.ptr)); |
1198 | 1227 | ||
1228 | if (new_obj->transport) { | ||
1229 | new_obj->transport->init_sent_count++; | ||
1230 | asoc->init_last_sent_to = new_obj->transport; | ||
1231 | } | ||
1232 | |||
1199 | /* FIXME - Eventually come up with a cleaner way to | 1233 | /* FIXME - Eventually come up with a cleaner way to |
1200 | * enabling COOKIE-ECHO + DATA bundling during | 1234 | * enabling COOKIE-ECHO + DATA bundling during |
1201 | * multihoming stale cookie scenarios, the following | 1235 | * multihoming stale cookie scenarios, the following |
@@ -1345,26 +1379,9 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | |||
1345 | * all transports have been tried at the current | 1379 | * all transports have been tried at the current |
1346 | * timeout. | 1380 | * timeout. |
1347 | */ | 1381 | */ |
1348 | t = asoc->init_last_sent_to; | 1382 | sctp_cmd_t1_timer_update(asoc, |
1349 | asoc->init_err_counter++; | 1383 | SCTP_EVENT_TIMEOUT_T1_INIT, |
1350 | 1384 | "INIT"); | |
1351 | if (t->init_sent_count > (asoc->init_cycle + 1)) { | ||
1352 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_INIT] *= 2; | ||
1353 | if (asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_INIT] > | ||
1354 | asoc->max_init_timeo) { | ||
1355 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_INIT] = | ||
1356 | asoc->max_init_timeo; | ||
1357 | } | ||
1358 | asoc->init_cycle++; | ||
1359 | SCTP_DEBUG_PRINTK( | ||
1360 | "T1 INIT Timeout adjustment" | ||
1361 | " init_err_counter: %d" | ||
1362 | " cycle: %d" | ||
1363 | " timeout: %ld\n", | ||
1364 | asoc->init_err_counter, | ||
1365 | asoc->init_cycle, | ||
1366 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_INIT]); | ||
1367 | } | ||
1368 | 1385 | ||
1369 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART, | 1386 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART, |
1370 | SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT)); | 1387 | SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT)); |
@@ -1377,20 +1394,9 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | |||
1377 | * all transports have been tried at the current | 1394 | * all transports have been tried at the current |
1378 | * timeout. | 1395 | * timeout. |
1379 | */ | 1396 | */ |
1380 | asoc->init_err_counter++; | 1397 | sctp_cmd_t1_timer_update(asoc, |
1381 | 1398 | SCTP_EVENT_TIMEOUT_T1_COOKIE, | |
1382 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_COOKIE] *= 2; | 1399 | "COOKIE"); |
1383 | if (asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_COOKIE] > | ||
1384 | asoc->max_init_timeo) { | ||
1385 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_COOKIE] = | ||
1386 | asoc->max_init_timeo; | ||
1387 | } | ||
1388 | SCTP_DEBUG_PRINTK( | ||
1389 | "T1 COOKIE Timeout adjustment" | ||
1390 | " init_err_counter: %d" | ||
1391 | " timeout: %ld\n", | ||
1392 | asoc->init_err_counter, | ||
1393 | asoc->timeouts[SCTP_EVENT_TIMEOUT_T1_COOKIE]); | ||
1394 | 1400 | ||
1395 | /* If we've sent any data bundled with | 1401 | /* If we've sent any data bundled with |
1396 | * COOKIE-ECHO we need to resend. | 1402 | * COOKIE-ECHO we need to resend. |
@@ -1422,6 +1428,10 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | |||
1422 | case SCTP_CMD_INIT_COUNTER_RESET: | 1428 | case SCTP_CMD_INIT_COUNTER_RESET: |
1423 | asoc->init_err_counter = 0; | 1429 | asoc->init_err_counter = 0; |
1424 | asoc->init_cycle = 0; | 1430 | asoc->init_cycle = 0; |
1431 | list_for_each_entry(t, &asoc->peer.transport_addr_list, | ||
1432 | transports) { | ||
1433 | t->init_sent_count = 0; | ||
1434 | } | ||
1425 | break; | 1435 | break; |
1426 | 1436 | ||
1427 | case SCTP_CMD_REPORT_DUP: | 1437 | case SCTP_CMD_REPORT_DUP: |