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

Function sctp_handle_old_unordered_data

freebsd/netinet/sctp_indata.c:767–910  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

765}
766
767static int
768sctp_handle_old_unordered_data(struct sctp_tcb *stcb,
769 struct sctp_association *asoc,
770 struct sctp_stream_in *strm,
771 struct sctp_queued_to_read *control,
772 uint32_t pd_point,
773 int inp_read_lock_held)
774{
775 /*
776 * Special handling for the old un-ordered data chunk. All the
777 * chunks/TSN's go to mid 0. So we have to do the old style watching
778 * to see if we have it all. If you return one, no other control
779 * entries on the un-ordered queue will be looked at. In theory
780 * there should be no others entries in reality, unless the guy is
781 * sending both unordered NDATA and unordered DATA...
782 */
783 struct sctp_tmit_chunk *chk, *lchk, *tchk;
784 uint32_t fsn;
785 struct sctp_queued_to_read *nc;
786 int cnt_added;
787
788 if (control->first_frag_seen == 0) {
789 /* Nothing we can do, we have not seen the first piece yet */
790 return (1);
791 }
792 /* Collapse any we can */
793 cnt_added = 0;
794restart:
795 fsn = control->fsn_included + 1;
796 /* Now what can we add? */
797 TAILQ_FOREACH_SAFE(chk, &control->reasm, sctp_next, lchk) {
798 if (chk->rec.data.fsn == fsn) {
799 /* Ok lets add it */
800 sctp_alloc_a_readq(stcb, nc);
801 if (nc == NULL) {
802 break;
803 }
804 memset(nc, 0, sizeof(struct sctp_queued_to_read));
805 TAILQ_REMOVE(&control->reasm, chk, sctp_next);
806 sctp_add_chk_to_control(control, strm, stcb, asoc, chk, inp_read_lock_held);
807 fsn++;
808 cnt_added++;
809 chk = NULL;
810 if (control->end_added) {
811 /* We are done */
812 if (!TAILQ_EMPTY(&control->reasm)) {
813 /*
814 * Ok we have to move anything left
815 * on the control queue to a new
816 * control.
817 */
818 sctp_build_readq_entry_from_ctl(nc, control);
819 tchk = TAILQ_FIRST(&control->reasm);
820 if (tchk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) {
821 TAILQ_REMOVE(&control->reasm, tchk, sctp_next);
822 if (asoc->size_on_reasm_queue >= tchk->send_size) {
823 asoc->size_on_reasm_queue -= tchk->send_size;
824 } else {

Callers 1

sctp_deliver_reasm_checkFunction · 0.85

Calls 8

memsetFunction · 0.85
sctp_add_chk_to_controlFunction · 0.85
sctp_mark_non_revokableFunction · 0.85
sctp_setup_tail_pointerFunction · 0.85
sctp_add_to_readqFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected