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

Function sctp_abort

freebsd/netinet/sctp_usrreq.c:414–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

412
413#ifdef INET
414static void
415sctp_abort(struct socket *so)
416{
417 struct epoch_tracker et;
418 struct sctp_inpcb *inp;
419 uint32_t flags;
420
421 inp = (struct sctp_inpcb *)so->so_pcb;
422 if (inp == NULL) {
423 return;
424 }
425
426 NET_EPOCH_ENTER(et);
427sctp_must_try_again:
428 flags = inp->sctp_flags;
429#ifdef SCTP_LOG_CLOSING
430 sctp_log_closing(inp, NULL, 17);
431#endif
432 if (((flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) &&
433 (atomic_cmpset_int(&inp->sctp_flags, flags, (flags | SCTP_PCB_FLAGS_SOCKET_GONE | SCTP_PCB_FLAGS_CLOSE_IP)))) {
434#ifdef SCTP_LOG_CLOSING
435 sctp_log_closing(inp, NULL, 16);
436#endif
437 sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_ABORT,
438 SCTP_CALLED_AFTER_CMPSET_OFCLOSE);
439 SOCK_LOCK(so);
440 SCTP_SB_CLEAR(so->so_snd);
441 /*
442 * same for the rcv ones, they are only here for the
443 * accounting/select.
444 */
445 SCTP_SB_CLEAR(so->so_rcv);
446
447 /* Now null out the reference, we are completely detached. */
448 so->so_pcb = NULL;
449 SOCK_UNLOCK(so);
450 } else {
451 flags = inp->sctp_flags;
452 if ((flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) {
453 goto sctp_must_try_again;
454 }
455 }
456 NET_EPOCH_EXIT(et);
457 return;
458}
459
460static int
461sctp_attach(struct socket *so, int proto SCTP_UNUSED, struct thread *p SCTP_UNUSED)

Callers

nothing calls this directly

Calls 2

sctp_inpcb_freeFunction · 0.85
sctp_log_closingFunction · 0.70

Tested by

no test coverage detected