| 4353 | */ |
| 4354 | #ifdef __GNUC__ |
| 4355 | __attribute__((noinline)) |
| 4356 | #endif |
| 4357 | static struct sctp_tcb * |
| 4358 | sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, |
| 4359 | struct sockaddr *src, struct sockaddr *dst, |
| 4360 | struct sctphdr *sh, struct sctp_chunkhdr *ch, struct sctp_inpcb *inp, |
| 4361 | struct sctp_tcb *stcb, struct sctp_nets **netp, int *fwd_tsn_seen, |
| 4362 | uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum, |
| 4363 | uint32_t vrf_id, uint16_t port) |
| 4364 | { |
| 4365 | struct sctp_association *asoc; |
| 4366 | struct mbuf *op_err; |
| 4367 | char msg[SCTP_DIAG_INFO_LEN]; |
| 4368 | uint32_t vtag_in; |
| 4369 | int num_chunks = 0; /* number of control chunks processed */ |
| 4370 | uint32_t chk_length, contiguous; |
| 4371 | int ret; |
| 4372 | int abort_no_unlock = 0; |
| 4373 | int ecne_seen = 0; |
| 4374 | |
| 4375 | /* |
| 4376 | * How big should this be, and should it be alloc'd? Lets try the |
| 4377 | * d-mtu-ceiling for now (2k) and that should hopefully work ... |
| 4378 | * until we get into jumbo grams and such.. |
| 4379 | */ |
| 4380 | uint8_t chunk_buf[SCTP_CHUNK_BUFFER_SIZE]; |
| 4381 | int got_auth = 0; |
| 4382 | uint32_t auth_offset = 0, auth_len = 0; |
| 4383 | int auth_skipped = 0; |
| 4384 | int asconf_cnt = 0; |
| 4385 | |
| 4386 | SCTPDBG(SCTP_DEBUG_INPUT1, "sctp_process_control: iphlen=%u, offset=%u, length=%u stcb:%p\n", |
| 4387 | iphlen, *offset, length, (void *)stcb); |
| 4388 | |
| 4389 | if (stcb) { |
| 4390 | SCTP_TCB_LOCK_ASSERT(stcb); |
| 4391 | } |
| 4392 | /* validate chunk header length... */ |
| 4393 | if (ntohs(ch->chunk_length) < sizeof(*ch)) { |
| 4394 | SCTPDBG(SCTP_DEBUG_INPUT1, "Invalid header length %d\n", |
| 4395 | ntohs(ch->chunk_length)); |
| 4396 | *offset = length; |
| 4397 | return (stcb); |
| 4398 | } |
| 4399 | /* |
| 4400 | * validate the verification tag |
| 4401 | */ |
| 4402 | vtag_in = ntohl(sh->v_tag); |
| 4403 | |
| 4404 | if (ch->chunk_type == SCTP_INITIATION) { |
| 4405 | SCTPDBG(SCTP_DEBUG_INPUT1, "Its an INIT of len:%d vtag:%x\n", |
| 4406 | ntohs(ch->chunk_length), vtag_in); |
| 4407 | if (vtag_in != 0) { |
| 4408 | /* protocol error- silently discard... */ |
| 4409 | SCTP_STAT_INCR(sctps_badvtag); |
| 4410 | if (stcb != NULL) { |
| 4411 | SCTP_TCB_UNLOCK(stcb); |
| 4412 | } |
no test coverage detected