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

Function sctp_handle_ootb

freebsd/netinet/sctputil.c:4483–4547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4481}
4482
4483void
4484sctp_handle_ootb(struct mbuf *m, int iphlen, int offset,
4485 struct sockaddr *src, struct sockaddr *dst,
4486 struct sctphdr *sh, struct sctp_inpcb *inp,
4487 struct mbuf *cause,
4488 uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum,
4489 uint32_t vrf_id, uint16_t port)
4490{
4491 struct sctp_chunkhdr *ch, chunk_buf;
4492 unsigned int chk_length;
4493 int contains_init_chunk;
4494
4495 SCTP_STAT_INCR_COUNTER32(sctps_outoftheblue);
4496 /* Generate a TO address for future reference */
4497 if (inp && (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) {
4498 if (LIST_EMPTY(&inp->sctp_asoc_list)) {
4499 sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_ABORT,
4500 SCTP_CALLED_DIRECTLY_NOCMPSET);
4501 }
4502 }
4503 contains_init_chunk = 0;
4504 ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, offset,
4505 sizeof(*ch), (uint8_t *)&chunk_buf);
4506 while (ch != NULL) {
4507 chk_length = ntohs(ch->chunk_length);
4508 if (chk_length < sizeof(*ch)) {
4509 /* break to abort land */
4510 break;
4511 }
4512 switch (ch->chunk_type) {
4513 case SCTP_INIT:
4514 contains_init_chunk = 1;
4515 break;
4516 case SCTP_PACKET_DROPPED:
4517 /* we don't respond to pkt-dropped */
4518 return;
4519 case SCTP_ABORT_ASSOCIATION:
4520 /* we don't respond with an ABORT to an ABORT */
4521 return;
4522 case SCTP_SHUTDOWN_COMPLETE:
4523 /*
4524 * we ignore it since we are not waiting for it and
4525 * peer is gone
4526 */
4527 return;
4528 case SCTP_SHUTDOWN_ACK:
4529 sctp_send_shutdown_complete2(src, dst, sh,
4530 mflowtype, mflowid, fibnum,
4531 vrf_id, port);
4532 return;
4533 default:
4534 break;
4535 }
4536 offset += SCTP_SIZE32(chk_length);
4537 ch = (struct sctp_chunkhdr *)sctp_m_getptr(m, offset,
4538 sizeof(*ch), (uint8_t *)&chunk_buf);
4539 }
4540 if ((SCTP_BASE_SYSCTL(sctp_blackhole) == 0) ||

Callers 2

sctp_process_controlFunction · 0.85

Calls 4

sctp_inpcb_freeFunction · 0.85
sctp_m_getptrFunction · 0.85
sctp_send_abortFunction · 0.85

Tested by

no test coverage detected