MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sctp_process_cookie_existing

Function sctp_process_cookie_existing

freebsd/netinet/sctp_input.c:1418–1985  ·  view source on GitHub ↗

* handle a state cookie for an existing association m: input packet mbuf * chain-- assumes a pullup on IP/SCTP/COOKIE-ECHO chunk note: this is a * "split" mbuf and the cookie signature does not exist offset: offset into * mbuf to the cookie-echo chunk */

Source from the content-addressed store, hash-verified

1416 * mbuf to the cookie-echo chunk
1417 */
1418static struct sctp_tcb *
1419sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset,
1420 struct sockaddr *src, struct sockaddr *dst,
1421 struct sctphdr *sh, struct sctp_state_cookie *cookie, int cookie_len,
1422 struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets **netp,
1423 struct sockaddr *init_src, int *notification,
1424 int auth_skipped, uint32_t auth_offset, uint32_t auth_len,
1425 uint8_t mflowtype, uint32_t mflowid,
1426 uint32_t vrf_id, uint16_t port)
1427{
1428 struct sctp_association *asoc;
1429 struct sctp_init_chunk *init_cp, init_buf;
1430 struct sctp_init_ack_chunk *initack_cp, initack_buf;
1431 struct sctp_asconf_addr *aparam, *naparam;
1432 struct sctp_asconf_ack *aack, *naack;
1433 struct sctp_tmit_chunk *chk, *nchk;
1434 struct sctp_stream_reset_list *strrst, *nstrrst;
1435 struct sctp_queued_to_read *sq, *nsq;
1436 struct sctp_nets *net;
1437 struct mbuf *op_err;
1438 struct timeval old;
1439 int init_offset, initack_offset, i;
1440 int retval;
1441 int spec_flag = 0;
1442 uint32_t how_indx;
1443#if defined(SCTP_DETAILED_STR_STATS)
1444 int j;
1445#endif
1446
1447 net = *netp;
1448 /* I know that the TCB is non-NULL from the caller */
1449 asoc = &stcb->asoc;
1450 for (how_indx = 0; how_indx < sizeof(asoc->cookie_how); how_indx++) {
1451 if (asoc->cookie_how[how_indx] == 0)
1452 break;
1453 }
1454 if (how_indx < sizeof(asoc->cookie_how)) {
1455 asoc->cookie_how[how_indx] = 1;
1456 }
1457 if (SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_ACK_SENT) {
1458 /* SHUTDOWN came in after sending INIT-ACK */
1459 sctp_send_shutdown_ack(stcb, stcb->asoc.primary_destination);
1460 op_err = sctp_generate_cause(SCTP_CAUSE_COOKIE_IN_SHUTDOWN, "");
1461 sctp_send_operr_to(src, dst, sh, cookie->peers_vtag, op_err,
1462 mflowtype, mflowid, inp->fibnum,
1463 vrf_id, net->port);
1464 if (how_indx < sizeof(asoc->cookie_how))
1465 asoc->cookie_how[how_indx] = 2;
1466 return (NULL);
1467 }
1468 /*
1469 * find and validate the INIT chunk in the cookie (peer's info) the
1470 * INIT should start after the cookie-echo header struct (chunk
1471 * header, state cookie header struct)
1472 */
1473 init_offset = offset += sizeof(struct sctp_cookie_echo_chunk);
1474
1475 init_cp = (struct sctp_init_chunk *)

Callers 1

sctp_handle_cookie_echoFunction · 0.85

Calls 15

sctp_send_shutdown_ackFunction · 0.85
sctp_generate_causeFunction · 0.85
sctp_send_operr_toFunction · 0.85
sctp_m_getptrFunction · 0.85
sctp_process_initFunction · 0.85
sctp_timer_stopFunction · 0.85
sctp_timer_startFunction · 0.85
soisconnectedFunction · 0.85
sctp_calculate_rtoFunction · 0.85
sctp_toss_old_cookiesFunction · 0.85

Tested by

no test coverage detected