| 1687 | } |
| 1688 | |
| 1689 | static int |
| 1690 | sctp_process_a_data_chunk(struct sctp_tcb *stcb, struct sctp_association *asoc, |
| 1691 | struct mbuf **m, int offset, int chk_length, |
| 1692 | struct sctp_nets *net, uint32_t *high_tsn, int *abort_flag, |
| 1693 | int *break_flag, int last_chunk, uint8_t chk_type) |
| 1694 | { |
| 1695 | struct sctp_tmit_chunk *chk = NULL; /* make gcc happy */ |
| 1696 | struct sctp_stream_in *strm; |
| 1697 | uint32_t tsn, fsn, gap, mid; |
| 1698 | struct mbuf *dmbuf; |
| 1699 | int the_len; |
| 1700 | int need_reasm_check = 0; |
| 1701 | uint16_t sid; |
| 1702 | struct mbuf *op_err; |
| 1703 | char msg[SCTP_DIAG_INFO_LEN]; |
| 1704 | struct sctp_queued_to_read *control, *ncontrol; |
| 1705 | uint32_t ppid; |
| 1706 | uint8_t chk_flags; |
| 1707 | struct sctp_stream_reset_list *liste; |
| 1708 | int ordered; |
| 1709 | size_t clen; |
| 1710 | int created_control = 0; |
| 1711 | |
| 1712 | if (chk_type == SCTP_IDATA) { |
| 1713 | struct sctp_idata_chunk *chunk, chunk_buf; |
| 1714 | |
| 1715 | chunk = (struct sctp_idata_chunk *)sctp_m_getptr(*m, offset, |
| 1716 | sizeof(struct sctp_idata_chunk), (uint8_t *)&chunk_buf); |
| 1717 | chk_flags = chunk->ch.chunk_flags; |
| 1718 | clen = sizeof(struct sctp_idata_chunk); |
| 1719 | tsn = ntohl(chunk->dp.tsn); |
| 1720 | sid = ntohs(chunk->dp.sid); |
| 1721 | mid = ntohl(chunk->dp.mid); |
| 1722 | if (chk_flags & SCTP_DATA_FIRST_FRAG) { |
| 1723 | fsn = 0; |
| 1724 | ppid = chunk->dp.ppid_fsn.ppid; |
| 1725 | } else { |
| 1726 | fsn = ntohl(chunk->dp.ppid_fsn.fsn); |
| 1727 | ppid = 0xffffffff; /* Use as an invalid value. */ |
| 1728 | } |
| 1729 | } else { |
| 1730 | struct sctp_data_chunk *chunk, chunk_buf; |
| 1731 | |
| 1732 | chunk = (struct sctp_data_chunk *)sctp_m_getptr(*m, offset, |
| 1733 | sizeof(struct sctp_data_chunk), (uint8_t *)&chunk_buf); |
| 1734 | chk_flags = chunk->ch.chunk_flags; |
| 1735 | clen = sizeof(struct sctp_data_chunk); |
| 1736 | tsn = ntohl(chunk->dp.tsn); |
| 1737 | sid = ntohs(chunk->dp.sid); |
| 1738 | mid = (uint32_t)(ntohs(chunk->dp.ssn)); |
| 1739 | fsn = tsn; |
| 1740 | ppid = chunk->dp.ppid; |
| 1741 | } |
| 1742 | if ((size_t)chk_length == clen) { |
| 1743 | /* |
| 1744 | * Need to send an abort since we had a empty data chunk. |
| 1745 | */ |
| 1746 | op_err = sctp_generate_no_user_data_cause(tsn); |
no test coverage detected