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

Function sctp_handle_init_ack

freebsd/netinet/sctp_input.c:1261–1400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1259}
1260
1261static int
1262sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset,
1263 struct sockaddr *src, struct sockaddr *dst, struct sctphdr *sh,
1264 struct sctp_init_ack_chunk *cp, struct sctp_tcb *stcb,
1265 struct sctp_nets *net, int *abort_no_unlock,
1266 uint8_t mflowtype, uint32_t mflowid,
1267 uint32_t vrf_id)
1268{
1269 struct sctp_init_ack *init_ack;
1270 struct mbuf *op_err;
1271
1272 SCTPDBG(SCTP_DEBUG_INPUT2,
1273 "sctp_handle_init_ack: handling INIT-ACK\n");
1274
1275 if (stcb == NULL) {
1276 SCTPDBG(SCTP_DEBUG_INPUT2,
1277 "sctp_handle_init_ack: TCB is null\n");
1278 return (-1);
1279 }
1280 if (ntohs(cp->ch.chunk_length) < sizeof(struct sctp_init_ack_chunk)) {
1281 /* Invalid length */
1282 op_err = sctp_generate_cause(SCTP_CAUSE_INVALID_PARAM, "");
1283 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen,
1284 src, dst, sh, op_err,
1285 mflowtype, mflowid,
1286 vrf_id, net->port);
1287 *abort_no_unlock = 1;
1288 return (-1);
1289 }
1290 init_ack = &cp->init;
1291 /* validate parameters */
1292 if (init_ack->initiate_tag == 0) {
1293 /* protocol error... send an abort */
1294 op_err = sctp_generate_cause(SCTP_CAUSE_INVALID_PARAM, "");
1295 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen,
1296 src, dst, sh, op_err,
1297 mflowtype, mflowid,
1298 vrf_id, net->port);
1299 *abort_no_unlock = 1;
1300 return (-1);
1301 }
1302 if (ntohl(init_ack->a_rwnd) < SCTP_MIN_RWND) {
1303 /* protocol error... send an abort */
1304 op_err = sctp_generate_cause(SCTP_CAUSE_INVALID_PARAM, "");
1305 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen,
1306 src, dst, sh, op_err,
1307 mflowtype, mflowid,
1308 vrf_id, net->port);
1309 *abort_no_unlock = 1;
1310 return (-1);
1311 }
1312 if (init_ack->num_inbound_streams == 0) {
1313 /* protocol error... send an abort */
1314 op_err = sctp_generate_cause(SCTP_CAUSE_INVALID_PARAM, "");
1315 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen,
1316 src, dst, sh, op_err,
1317 mflowtype, mflowid,
1318 vrf_id, net->port);

Callers 1

sctp_process_controlFunction · 0.85

Calls 6

sctp_generate_causeFunction · 0.85
sctp_abort_associationFunction · 0.85
sctp_ulp_notifyFunction · 0.85
sctp_process_init_ackFunction · 0.85
sctp_misc_intsFunction · 0.85
sctp_timer_startFunction · 0.85

Tested by

no test coverage detected