| 765 | } |
| 766 | |
| 767 | static int |
| 768 | sctp_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; |
| 794 | restart: |
| 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 { |
no test coverage detected