| 1619 | } |
| 1620 | |
| 1621 | static void |
| 1622 | sctp_handle_addr_wq(void) |
| 1623 | { |
| 1624 | /* deal with the ADDR wq from the rtsock calls */ |
| 1625 | struct sctp_laddr *wi, *nwi; |
| 1626 | struct sctp_asconf_iterator *asc; |
| 1627 | |
| 1628 | SCTP_MALLOC(asc, struct sctp_asconf_iterator *, |
| 1629 | sizeof(struct sctp_asconf_iterator), SCTP_M_ASC_IT); |
| 1630 | if (asc == NULL) { |
| 1631 | /* Try later, no memory */ |
| 1632 | sctp_timer_start(SCTP_TIMER_TYPE_ADDR_WQ, |
| 1633 | (struct sctp_inpcb *)NULL, |
| 1634 | (struct sctp_tcb *)NULL, |
| 1635 | (struct sctp_nets *)NULL); |
| 1636 | return; |
| 1637 | } |
| 1638 | LIST_INIT(&asc->list_of_work); |
| 1639 | asc->cnt = 0; |
| 1640 | |
| 1641 | LIST_FOREACH_SAFE(wi, &SCTP_BASE_INFO(addr_wq), sctp_nxt_addr, nwi) { |
| 1642 | LIST_REMOVE(wi, sctp_nxt_addr); |
| 1643 | LIST_INSERT_HEAD(&asc->list_of_work, wi, sctp_nxt_addr); |
| 1644 | asc->cnt++; |
| 1645 | } |
| 1646 | |
| 1647 | if (asc->cnt == 0) { |
| 1648 | SCTP_FREE(asc, SCTP_M_ASC_IT); |
| 1649 | } else { |
| 1650 | int ret; |
| 1651 | |
| 1652 | ret = sctp_initiate_iterator(sctp_asconf_iterator_ep, |
| 1653 | sctp_asconf_iterator_stcb, |
| 1654 | NULL, /* No ep end for boundall */ |
| 1655 | SCTP_PCB_FLAGS_BOUNDALL, |
| 1656 | SCTP_PCB_ANY_FEATURES, |
| 1657 | SCTP_ASOC_ANY_STATE, |
| 1658 | (void *)asc, 0, |
| 1659 | sctp_asconf_iterator_end, NULL, 0); |
| 1660 | if (ret) { |
| 1661 | SCTP_PRINTF("Failed to initiate iterator for handle_addr_wq\n"); |
| 1662 | /* |
| 1663 | * Freeing if we are stopping or put back on the |
| 1664 | * addr_wq. |
| 1665 | */ |
| 1666 | if (SCTP_BASE_VAR(sctp_pcb_initialized) == 0) { |
| 1667 | sctp_asconf_iterator_end(asc, 0); |
| 1668 | } else { |
| 1669 | LIST_FOREACH(wi, &asc->list_of_work, sctp_nxt_addr) { |
| 1670 | LIST_INSERT_HEAD(&SCTP_BASE_INFO(addr_wq), wi, sctp_nxt_addr); |
| 1671 | } |
| 1672 | SCTP_FREE(asc, SCTP_M_ASC_IT); |
| 1673 | } |
| 1674 | } |
| 1675 | } |
| 1676 | } |
| 1677 | |
| 1678 | /*- |
no test coverage detected