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

Function sctp_asconf_process_error

freebsd/netinet/sctp_asconf.c:1562–1607  ·  view source on GitHub ↗

* process an SCTP_ERROR_CAUSE_IND for a ASCONF-ACK parameter and do * notifications based on the error response */

Source from the content-addressed store, hash-verified

1560 * notifications based on the error response
1561 */
1562static void
1563sctp_asconf_process_error(struct sctp_tcb *stcb SCTP_UNUSED,
1564 struct sctp_asconf_paramhdr *aph)
1565{
1566 struct sctp_error_cause *eh;
1567 struct sctp_paramhdr *ph;
1568 uint16_t param_type;
1569 uint16_t error_code;
1570
1571 eh = (struct sctp_error_cause *)(aph + 1);
1572 ph = (struct sctp_paramhdr *)(eh + 1);
1573 /* validate lengths */
1574 if (htons(eh->length) + sizeof(struct sctp_error_cause) >
1575 htons(aph->ph.param_length)) {
1576 /* invalid error cause length */
1577 SCTPDBG(SCTP_DEBUG_ASCONF1,
1578 "asconf_process_error: cause element too long\n");
1579 return;
1580 }
1581 if (htons(ph->param_length) + sizeof(struct sctp_paramhdr) >
1582 htons(eh->length)) {
1583 /* invalid included TLV length */
1584 SCTPDBG(SCTP_DEBUG_ASCONF1,
1585 "asconf_process_error: included TLV too long\n");
1586 return;
1587 }
1588 /* which error code ? */
1589 error_code = ntohs(eh->code);
1590 param_type = ntohs(aph->ph.param_type);
1591 /* FIX: this should go back up the REMOTE_ERROR ULP notify */
1592 switch (error_code) {
1593 case SCTP_CAUSE_RESOURCE_SHORTAGE:
1594 /* we allow ourselves to "try again" for this error */
1595 break;
1596 default:
1597 /* peer can't handle it... */
1598 switch (param_type) {
1599 case SCTP_ADD_IP_ADDRESS:
1600 case SCTP_DEL_IP_ADDRESS:
1601 case SCTP_SET_PRIM_ADDR:
1602 break;
1603 default:
1604 break;
1605 }
1606 }
1607}
1608
1609/*
1610 * process an asconf queue param.

Callers 1

sctp_handle_asconf_ackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected