| 59 | extern const struct sctp_ss_functions sctp_ss_functions[]; |
| 60 | |
| 61 | void |
| 62 | sctp_init(void) |
| 63 | { |
| 64 | u_long sb_max_adj; |
| 65 | |
| 66 | /* Initialize and modify the sysctled variables */ |
| 67 | sctp_init_sysctls(); |
| 68 | if ((nmbclusters / 8) > SCTP_ASOC_MAX_CHUNKS_ON_QUEUE) |
| 69 | SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue) = (nmbclusters / 8); |
| 70 | /* |
| 71 | * Allow a user to take no more than 1/2 the number of clusters or |
| 72 | * the SB_MAX, whichever is smaller, for the send window. |
| 73 | */ |
| 74 | sb_max_adj = (u_long)((u_quad_t)(SB_MAX) * MCLBYTES / (MSIZE + MCLBYTES)); |
| 75 | SCTP_BASE_SYSCTL(sctp_sendspace) = min(sb_max_adj, |
| 76 | (((uint32_t)nmbclusters / 2) * SCTP_DEFAULT_MAXSEGMENT)); |
| 77 | /* |
| 78 | * Now for the recv window, should we take the same amount? or |
| 79 | * should I do 1/2 the SB_MAX instead in the SB_MAX min above. For |
| 80 | * now I will just copy. |
| 81 | */ |
| 82 | SCTP_BASE_SYSCTL(sctp_recvspace) = SCTP_BASE_SYSCTL(sctp_sendspace); |
| 83 | SCTP_BASE_VAR(first_time) = 0; |
| 84 | SCTP_BASE_VAR(sctp_pcb_initialized) = 0; |
| 85 | sctp_pcb_init(); |
| 86 | #if defined(SCTP_PACKET_LOGGING) |
| 87 | SCTP_BASE_VAR(packet_log_writers) = 0; |
| 88 | SCTP_BASE_VAR(packet_log_end) = 0; |
| 89 | memset(&SCTP_BASE_VAR(packet_log_buffer), 0, SCTP_PACKET_LOG_SIZE); |
| 90 | #endif |
| 91 | SCTP_BASE_VAR(eh_tag) = EVENTHANDLER_REGISTER(rt_addrmsg, |
| 92 | sctp_addr_change_event_handler, NULL, EVENTHANDLER_PRI_FIRST); |
| 93 | } |
| 94 | |
| 95 | #ifdef VIMAGE |
| 96 | static void |
nothing calls this directly
no test coverage detected