| 630 | } |
| 631 | |
| 632 | static void |
| 633 | sctp_setup_tail_pointer(struct sctp_queued_to_read *control) |
| 634 | { |
| 635 | struct mbuf *m, *prev = NULL; |
| 636 | struct sctp_tcb *stcb; |
| 637 | |
| 638 | stcb = control->stcb; |
| 639 | control->held_length = 0; |
| 640 | control->length = 0; |
| 641 | m = control->data; |
| 642 | while (m) { |
| 643 | if (SCTP_BUF_LEN(m) == 0) { |
| 644 | /* Skip mbufs with NO length */ |
| 645 | if (prev == NULL) { |
| 646 | /* First one */ |
| 647 | control->data = sctp_m_free(m); |
| 648 | m = control->data; |
| 649 | } else { |
| 650 | SCTP_BUF_NEXT(prev) = sctp_m_free(m); |
| 651 | m = SCTP_BUF_NEXT(prev); |
| 652 | } |
| 653 | if (m == NULL) { |
| 654 | control->tail_mbuf = prev; |
| 655 | } |
| 656 | continue; |
| 657 | } |
| 658 | prev = m; |
| 659 | atomic_add_int(&control->length, SCTP_BUF_LEN(m)); |
| 660 | if (control->on_read_q) { |
| 661 | /* |
| 662 | * On read queue so we must increment the SB stuff, |
| 663 | * we assume caller has done any locks of SB. |
| 664 | */ |
| 665 | sctp_sballoc(stcb, &stcb->sctp_socket->so_rcv, m); |
| 666 | } |
| 667 | m = SCTP_BUF_NEXT(m); |
| 668 | } |
| 669 | if (prev) { |
| 670 | control->tail_mbuf = prev; |
| 671 | } |
| 672 | } |
| 673 | |
| 674 | static void |
| 675 | sctp_add_to_tail_pointer(struct sctp_queued_to_read *control, struct mbuf *m, uint32_t *added) |
no test coverage detected