| 1178 | } |
| 1179 | |
| 1180 | int |
| 1181 | sctp_asconf_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb, |
| 1182 | struct sctp_nets *net) |
| 1183 | { |
| 1184 | struct sctp_nets *alt; |
| 1185 | struct sctp_tmit_chunk *asconf, *chk; |
| 1186 | |
| 1187 | /* is this a first send, or a retransmission? */ |
| 1188 | if (TAILQ_EMPTY(&stcb->asoc.asconf_send_queue)) { |
| 1189 | /* compose a new ASCONF chunk and send it */ |
| 1190 | sctp_send_asconf(stcb, net, SCTP_ADDR_NOT_LOCKED); |
| 1191 | } else { |
| 1192 | /* |
| 1193 | * Retransmission of the existing ASCONF is needed |
| 1194 | */ |
| 1195 | |
| 1196 | /* find the existing ASCONF */ |
| 1197 | asconf = TAILQ_FIRST(&stcb->asoc.asconf_send_queue); |
| 1198 | if (asconf == NULL) { |
| 1199 | return (0); |
| 1200 | } |
| 1201 | net = asconf->whoTo; |
| 1202 | /* do threshold management */ |
| 1203 | if (sctp_threshold_management(inp, stcb, net, |
| 1204 | stcb->asoc.max_send_times)) { |
| 1205 | /* Assoc is over */ |
| 1206 | return (1); |
| 1207 | } |
| 1208 | if (asconf->snd_count > stcb->asoc.max_send_times) { |
| 1209 | /* |
| 1210 | * Something is rotten: our peer is not responding |
| 1211 | * to ASCONFs but apparently is to other chunks. |
| 1212 | * i.e. it is not properly handling the chunk type |
| 1213 | * upper bits. Mark this peer as ASCONF incapable |
| 1214 | * and cleanup. |
| 1215 | */ |
| 1216 | SCTPDBG(SCTP_DEBUG_TIMER1, "asconf_timer: Peer has not responded to our repeated ASCONFs\n"); |
| 1217 | sctp_asconf_cleanup(stcb); |
| 1218 | return (0); |
| 1219 | } |
| 1220 | /* |
| 1221 | * cleared threshold management, so now backoff the net and |
| 1222 | * select an alternate |
| 1223 | */ |
| 1224 | sctp_backoff_on_timeout(stcb, net, 1, 0, 0); |
| 1225 | alt = sctp_find_alternate_net(stcb, net, 0); |
| 1226 | if (asconf->whoTo != alt) { |
| 1227 | asconf->whoTo = alt; |
| 1228 | atomic_add_int(&alt->ref_count, 1); |
| 1229 | } |
| 1230 | |
| 1231 | /* See if an ECN Echo is also stranded */ |
| 1232 | TAILQ_FOREACH(chk, &stcb->asoc.control_send_queue, sctp_next) { |
| 1233 | if ((chk->whoTo == net) && |
| 1234 | (chk->rec.chunk_id.id == SCTP_ECN_ECHO)) { |
| 1235 | sctp_free_remote_addr(chk->whoTo); |
| 1236 | chk->whoTo = alt; |
| 1237 | if (chk->sent != SCTP_DATAGRAM_RESEND) { |
no test coverage detected