* common input chunk processing (v4 and v6) */
| 5314 | * common input chunk processing (v4 and v6) |
| 5315 | */ |
| 5316 | void |
| 5317 | sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int length, |
| 5318 | struct sockaddr *src, struct sockaddr *dst, |
| 5319 | struct sctphdr *sh, struct sctp_chunkhdr *ch, |
| 5320 | uint8_t compute_crc, |
| 5321 | uint8_t ecn_bits, |
| 5322 | uint8_t mflowtype, uint32_t mflowid, uint16_t fibnum, |
| 5323 | uint32_t vrf_id, uint16_t port) |
| 5324 | { |
| 5325 | uint32_t high_tsn; |
| 5326 | int fwd_tsn_seen = 0, data_processed = 0; |
| 5327 | struct mbuf *m = *mm, *op_err; |
| 5328 | char msg[SCTP_DIAG_INFO_LEN]; |
| 5329 | int un_sent; |
| 5330 | int cnt_ctrl_ready = 0; |
| 5331 | struct sctp_inpcb *inp = NULL, *inp_decr = NULL; |
| 5332 | struct sctp_tcb *stcb = NULL; |
| 5333 | struct sctp_nets *net = NULL; |
| 5334 | |
| 5335 | SCTP_STAT_INCR(sctps_recvdatagrams); |
| 5336 | #ifdef SCTP_AUDITING_ENABLED |
| 5337 | sctp_audit_log(0xE0, 1); |
| 5338 | sctp_auditing(0, inp, stcb, net); |
| 5339 | #endif |
| 5340 | if (compute_crc != 0) { |
| 5341 | uint32_t check, calc_check; |
| 5342 | |
| 5343 | check = sh->checksum; |
| 5344 | sh->checksum = 0; |
| 5345 | calc_check = sctp_calculate_cksum(m, iphlen); |
| 5346 | sh->checksum = check; |
| 5347 | if (calc_check != check) { |
| 5348 | SCTPDBG(SCTP_DEBUG_INPUT1, "Bad CSUM on SCTP packet calc_check:%x check:%x m:%p mlen:%d iphlen:%d\n", |
| 5349 | calc_check, check, (void *)m, length, iphlen); |
| 5350 | stcb = sctp_findassociation_addr(m, offset, src, dst, |
| 5351 | sh, ch, &inp, &net, vrf_id); |
| 5352 | #if defined(INET) || defined(INET6) |
| 5353 | if ((ch->chunk_type != SCTP_INITIATION) && |
| 5354 | (net != NULL) && (net->port != port)) { |
| 5355 | if (net->port == 0) { |
| 5356 | /* UDP encapsulation turned on. */ |
| 5357 | net->mtu -= sizeof(struct udphdr); |
| 5358 | if (stcb->asoc.smallest_mtu > net->mtu) { |
| 5359 | sctp_pathmtu_adjustment(stcb, net->mtu); |
| 5360 | } |
| 5361 | } else if (port == 0) { |
| 5362 | /* UDP encapsulation turned off. */ |
| 5363 | net->mtu += sizeof(struct udphdr); |
| 5364 | /* XXX Update smallest_mtu */ |
| 5365 | } |
| 5366 | net->port = port; |
| 5367 | } |
| 5368 | #endif |
| 5369 | if (net != NULL) { |
| 5370 | net->flowtype = mflowtype; |
| 5371 | net->flowid = mflowid; |
| 5372 | } |
| 5373 | SCTP_PROBE5(receive, NULL, stcb, m, stcb, sh); |
no test coverage detected