net/sctp/sm_statefuns.c
Source file repositories/reference/linux-study-clean/net/sctp/sm_statefuns.c
File Facts
- System
- Linux kernel
- Corpus path
net/sctp/sm_statefuns.c- Extension
.c- Size
- 214335 bytes
- Lines
- 6691
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
crypto/utils.hlinux/types.hlinux/kernel.hlinux/ip.hlinux/ipv6.hlinux/net.hlinux/inet.hlinux/slab.hnet/sock.hnet/proto_memory.hnet/inet_ecn.hlinux/skbuff.hnet/sctp/sctp.hnet/sctp/sm.hnet/sctp/structs.htrace/events/sctp.h
Detected Declarations
function sctp_chunk_length_validfunction sctp_err_chunk_validfunction associationfunction Tagfunction sctp_sf_do_5_1C_ackfunction sctp_auth_chunk_verifyfunction chunksfunction notificationfunction sctp_sf_heartbeatfunction sctp_sf_sendbeat_8_3function sentfunction sctp_sf_send_reconffunction sctp_sf_send_probefunction sctp_sf_beat_8_3function wellfunction time_afterfunction sctp_sf_send_restart_abortfunction list_has_sctp_addrfunction list_for_each_entryfunction sctp_sf_check_restart_addrsfunction sctp_tietags_populatefunction sctp_tietags_comparefunction sctp_sf_do_unexpected_initfunction chunkfunction Tagfunction sctp_sf_do_5_2_3_initackfunction sctp_sf_do_assoc_updatefunction sctp_sf_do_dupcook_afunction restartedfunction sctp_statefunction sctp_sf_do_dupcook_bfunction sctp_sf_do_dupcook_cfunction sctp_sf_do_dupcook_dfunction sctp_sf_do_5_2_4_dupcookfunction sctp_sf_do_9_1_abortfunction sctp_sf_do_9_1_abortfunction sctp_sf_do_9_1_abortfunction sctp_sf_cookie_echoed_errfunction sctp_sf_do_5_2_6_stalefunction sctp_sf_do_9_1_abortfunction __sctp_sf_do_9_1_abortfunction sctp_sf_do_9_1_abortfunction sctp_sf_cookie_wait_icmp_abortfunction sctp_sf_cookie_echoed_abortfunction sctp_stop_t1_and_abortfunction sctp_sf_do_9_2_shutdownfunction sctp_sf_do_9_2_shut_ctsnfunction addresses
Annotated Snippet
if (err_chunk) {
packet = sctp_abort_pkt_new(net, ep, asoc, arg,
(__u8 *)(err_chunk->chunk_hdr) +
sizeof(struct sctp_chunkhdr),
ntohs(err_chunk->chunk_hdr->length) -
sizeof(struct sctp_chunkhdr));
sctp_chunk_free(err_chunk);
if (packet) {
sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT,
SCTP_PACKET(packet));
SCTP_INC_STATS(net, SCTP_MIB_OUTCTRLCHUNKS);
return SCTP_DISPOSITION_CONSUME;
} else {
return SCTP_DISPOSITION_NOMEM;
}
} else {
return sctp_sf_tabort_8_4_8(net, ep, asoc, type, arg,
commands);
}
}
/* Grab the INIT header. */
chunk->subh.init_hdr = (struct sctp_inithdr *)chunk->skb->data;
/* Tag the variable length parameters. */
chunk->param_hdr.v = skb_pull(chunk->skb, sizeof(struct sctp_inithdr));
new_asoc = sctp_make_temp_asoc(ep, chunk, GFP_ATOMIC);
if (!new_asoc)
goto nomem;
/* Update socket peer label if first association. */
if (security_sctp_assoc_request(new_asoc, chunk->skb)) {
sctp_association_free(new_asoc);
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
}
if (sctp_assoc_set_bind_addr_from_ep(new_asoc,
sctp_scope(sctp_source(chunk)),
GFP_ATOMIC) < 0)
goto nomem_init;
/* The call, sctp_process_init(), can fail on memory allocation. */
if (!sctp_process_init(new_asoc, chunk, sctp_source(chunk),
(struct sctp_init_chunk *)chunk->chunk_hdr,
GFP_ATOMIC))
goto nomem_init;
/* B) "Z" shall respond immediately with an INIT ACK chunk. */
/* If there are errors need to be reported for unknown parameters,
* make sure to reserve enough room in the INIT ACK for them.
*/
len = 0;
if (err_chunk)
len = ntohs(err_chunk->chunk_hdr->length) -
sizeof(struct sctp_chunkhdr);
repl = sctp_make_init_ack(new_asoc, chunk, GFP_ATOMIC, len);
if (!repl)
goto nomem_init;
/* If there are errors need to be reported for unknown parameters,
* include them in the outgoing INIT ACK as "Unrecognized parameter"
* parameter.
*/
if (err_chunk) {
/* Get the "Unrecognized parameter" parameter(s) out of the
* ERROR chunk generated by sctp_verify_init(). Since the
* error cause code for "unknown parameter" and the
* "Unrecognized parameter" type is the same, we can
* construct the parameters in INIT ACK by copying the
* ERROR causes over.
*/
unk_param = (struct sctp_unrecognized_param *)
((__u8 *)(err_chunk->chunk_hdr) +
sizeof(struct sctp_chunkhdr));
/* Replace the cause code with the "Unrecognized parameter"
* parameter type.
*/
sctp_addto_chunk(repl, len, unk_param);
sctp_chunk_free(err_chunk);
}
sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC, SCTP_ASOC(new_asoc));
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl));
Annotation
- Immediate include surface: `crypto/utils.h`, `linux/types.h`, `linux/kernel.h`, `linux/ip.h`, `linux/ipv6.h`, `linux/net.h`, `linux/inet.h`, `linux/slab.h`.
- Detected declarations: `function sctp_chunk_length_valid`, `function sctp_err_chunk_valid`, `function association`, `function Tag`, `function sctp_sf_do_5_1C_ack`, `function sctp_auth_chunk_verify`, `function chunks`, `function notification`, `function sctp_sf_heartbeat`, `function sctp_sf_sendbeat_8_3`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.