MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sctp_process_init

Function sctp_process_init

freebsd/netinet/sctp_input.c:280–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278}
279
280static int
281sctp_process_init(struct sctp_init_chunk *cp, struct sctp_tcb *stcb)
282{
283 struct sctp_init *init;
284 struct sctp_association *asoc;
285 struct sctp_nets *lnet;
286 unsigned int i;
287
288 init = &cp->init;
289 asoc = &stcb->asoc;
290 /* save off parameters */
291 asoc->peer_vtag = ntohl(init->initiate_tag);
292 asoc->peers_rwnd = ntohl(init->a_rwnd);
293 /* init tsn's */
294 asoc->highest_tsn_inside_map = asoc->asconf_seq_in = ntohl(init->initial_tsn) - 1;
295
296 if (!TAILQ_EMPTY(&asoc->nets)) {
297 /* update any ssthresh's that may have a default */
298 TAILQ_FOREACH(lnet, &asoc->nets, sctp_next) {
299 lnet->ssthresh = asoc->peers_rwnd;
300 if (SCTP_BASE_SYSCTL(sctp_logging_level) & (SCTP_CWND_MONITOR_ENABLE | SCTP_CWND_LOGGING_ENABLE)) {
301 sctp_log_cwnd(stcb, lnet, 0, SCTP_CWND_INITIALIZATION);
302 }
303 }
304 }
305 SCTP_TCB_SEND_LOCK(stcb);
306 if (asoc->pre_open_streams > ntohs(init->num_inbound_streams)) {
307 unsigned int newcnt;
308 struct sctp_stream_out *outs;
309 struct sctp_stream_queue_pending *sp, *nsp;
310 struct sctp_tmit_chunk *chk, *nchk;
311
312 /* abandon the upper streams */
313 newcnt = ntohs(init->num_inbound_streams);
314 TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) {
315 if (chk->rec.data.sid >= newcnt) {
316 TAILQ_REMOVE(&asoc->send_queue, chk, sctp_next);
317 asoc->send_queue_cnt--;
318 if (asoc->strmout[chk->rec.data.sid].chunks_on_queues > 0) {
319 asoc->strmout[chk->rec.data.sid].chunks_on_queues--;
320#ifdef INVARIANTS
321 } else {
322 panic("No chunks on the queues for sid %u.", chk->rec.data.sid);
323#endif
324 }
325 if (chk->data != NULL) {
326 sctp_free_bufspace(stcb, asoc, chk, 1);
327 sctp_ulp_notify(SCTP_NOTIFY_UNSENT_DG_FAIL, stcb,
328 0, chk, SCTP_SO_NOT_LOCKED);
329 if (chk->data) {
330 sctp_m_freem(chk->data);
331 chk->data = NULL;
332 }
333 }
334 sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED);
335 /* sa_ignore FREED_MEMORY */
336 }
337 }

Callers 3

sctp_process_init_ackFunction · 0.85
sctp_process_cookie_newFunction · 0.85

Calls 7

sctp_log_cwndFunction · 0.85
sctp_free_bufspaceFunction · 0.85
sctp_ulp_notifyFunction · 0.85
sctp_m_freemFunction · 0.85
sctp_log_mapFunction · 0.85
sctp_clean_up_streamFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected