| 4900 | } |
| 4901 | |
| 4902 | struct mbuf * |
| 4903 | sctp_arethere_unrecognized_parameters(struct mbuf *in_initpkt, |
| 4904 | int param_offset, int *abort_processing, |
| 4905 | struct sctp_chunkhdr *cp, |
| 4906 | int *nat_friendly, |
| 4907 | int *cookie_found) |
| 4908 | { |
| 4909 | /* |
| 4910 | * Given a mbuf containing an INIT or INIT-ACK with the param_offset |
| 4911 | * being equal to the beginning of the params i.e. (iphlen + |
| 4912 | * sizeof(struct sctp_init_msg) parse through the parameters to the |
| 4913 | * end of the mbuf verifying that all parameters are known. |
| 4914 | * |
| 4915 | * For unknown parameters build and return a mbuf with |
| 4916 | * UNRECOGNIZED_PARAMETER errors. If the flags indicate to stop |
| 4917 | * processing this chunk stop, and set *abort_processing to 1. |
| 4918 | * |
| 4919 | * By having param_offset be pre-set to where parameters begin it is |
| 4920 | * hoped that this routine may be reused in the future by new |
| 4921 | * features. |
| 4922 | */ |
| 4923 | struct sctp_paramhdr *phdr, params; |
| 4924 | |
| 4925 | struct mbuf *mat, *m_tmp, *op_err, *op_err_last; |
| 4926 | int at, limit, pad_needed; |
| 4927 | uint16_t ptype, plen, padded_size; |
| 4928 | |
| 4929 | *abort_processing = 0; |
| 4930 | if (cookie_found != NULL) { |
| 4931 | *cookie_found = 0; |
| 4932 | } |
| 4933 | mat = in_initpkt; |
| 4934 | limit = ntohs(cp->chunk_length) - sizeof(struct sctp_init_chunk); |
| 4935 | at = param_offset; |
| 4936 | op_err = NULL; |
| 4937 | op_err_last = NULL; |
| 4938 | pad_needed = 0; |
| 4939 | SCTPDBG(SCTP_DEBUG_OUTPUT1, "Check for unrecognized param's\n"); |
| 4940 | phdr = sctp_get_next_param(mat, at, ¶ms, sizeof(params)); |
| 4941 | while ((phdr != NULL) && ((size_t)limit >= sizeof(struct sctp_paramhdr))) { |
| 4942 | ptype = ntohs(phdr->param_type); |
| 4943 | plen = ntohs(phdr->param_length); |
| 4944 | if ((plen > limit) || (plen < sizeof(struct sctp_paramhdr))) { |
| 4945 | /* wacked parameter */ |
| 4946 | SCTPDBG(SCTP_DEBUG_OUTPUT1, "Invalid size - error %d\n", plen); |
| 4947 | goto invalid_size; |
| 4948 | } |
| 4949 | limit -= SCTP_SIZE32(plen); |
| 4950 | /*- |
| 4951 | * All parameters for all chunks that we know/understand are |
| 4952 | * listed here. We process them other places and make |
| 4953 | * appropriate stop actions per the upper bits. However this |
| 4954 | * is the generic routine processor's can call to get back |
| 4955 | * an operr.. to either incorporate (init-ack) or send. |
| 4956 | */ |
| 4957 | padded_size = SCTP_SIZE32(plen); |
| 4958 | switch (ptype) { |
| 4959 | /* Param's with variable size */ |
no test coverage detected