* handles a COOKIE-ECHO message stcb: modified to either a new or left as * existing (non-NULL) TCB */
| 2288 | * existing (non-NULL) TCB |
| 2289 | */ |
| 2290 | static struct mbuf * |
| 2291 | sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset, |
| 2292 | struct sockaddr *src, struct sockaddr *dst, |
| 2293 | struct sctphdr *sh, struct sctp_cookie_echo_chunk *cp, |
| 2294 | struct sctp_inpcb **inp_p, struct sctp_tcb **stcb, struct sctp_nets **netp, |
| 2295 | int auth_skipped, uint32_t auth_offset, uint32_t auth_len, |
| 2296 | struct sctp_tcb **locked_tcb, |
| 2297 | uint8_t mflowtype, uint32_t mflowid, |
| 2298 | uint32_t vrf_id, uint16_t port) |
| 2299 | { |
| 2300 | struct sctp_state_cookie *cookie; |
| 2301 | struct sctp_tcb *l_stcb = *stcb; |
| 2302 | struct sctp_inpcb *l_inp; |
| 2303 | struct sockaddr *to; |
| 2304 | struct sctp_pcb *ep; |
| 2305 | struct mbuf *m_sig; |
| 2306 | uint8_t calc_sig[SCTP_SIGNATURE_SIZE], tmp_sig[SCTP_SIGNATURE_SIZE]; |
| 2307 | uint8_t *sig; |
| 2308 | uint8_t cookie_ok = 0; |
| 2309 | unsigned int sig_offset, cookie_offset; |
| 2310 | unsigned int cookie_len; |
| 2311 | struct timeval now; |
| 2312 | struct timeval time_entered, time_expires; |
| 2313 | int notification = 0; |
| 2314 | struct sctp_nets *netl; |
| 2315 | int had_a_existing_tcb = 0; |
| 2316 | int send_int_conf = 0; |
| 2317 | #ifdef INET |
| 2318 | struct sockaddr_in sin; |
| 2319 | #endif |
| 2320 | #ifdef INET6 |
| 2321 | struct sockaddr_in6 sin6; |
| 2322 | #endif |
| 2323 | |
| 2324 | SCTPDBG(SCTP_DEBUG_INPUT2, |
| 2325 | "sctp_handle_cookie: handling COOKIE-ECHO\n"); |
| 2326 | |
| 2327 | if (inp_p == NULL) { |
| 2328 | return (NULL); |
| 2329 | } |
| 2330 | cookie = &cp->cookie; |
| 2331 | cookie_offset = offset + sizeof(struct sctp_chunkhdr); |
| 2332 | cookie_len = ntohs(cp->ch.chunk_length); |
| 2333 | |
| 2334 | if (cookie_len < sizeof(struct sctp_cookie_echo_chunk) + |
| 2335 | sizeof(struct sctp_init_chunk) + |
| 2336 | sizeof(struct sctp_init_ack_chunk) + SCTP_SIGNATURE_SIZE) { |
| 2337 | /* cookie too small */ |
| 2338 | return (NULL); |
| 2339 | } |
| 2340 | if ((cookie->peerport != sh->src_port) || |
| 2341 | (cookie->myport != sh->dest_port) || |
| 2342 | (cookie->my_vtag != sh->v_tag)) { |
| 2343 | /* |
| 2344 | * invalid ports or bad tag. Note that we always leave the |
| 2345 | * v_tag in the header in network order and when we stored |
| 2346 | * it in the my_vtag slot we also left it in network order. |
| 2347 | * This maintains the match even though it may be in the |
no test coverage detected