net/sctp/sm_make_chunk.c
Source file repositories/reference/linux-study-clean/net/sctp/sm_make_chunk.c
File Facts
- System
- Linux kernel
- Corpus path
net/sctp/sm_make_chunk.c- Extension
.c- Size
- 119440 bytes
- Lines
- 3916
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- 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/scatterlist.hlinux/slab.hnet/sock.hlinux/skbuff.hlinux/random.hnet/sctp/sctp.hnet/sctp/sm.h
Detected Declarations
struct __sctp_missingfunction sctp_control_release_ownerfunction sctp_control_set_owner_wfunction sctp_init_causefunction Addressfunction INITfunction minfunction sctp_init_addrsfunction sctp_chunk_destroyfunction sctp_chunk_freefunction sctp_chunk_holdfunction sctp_chunk_putfunction sctp_user_addto_chunkfunction sctp_chunk_assign_ssnfunction sctp_chunk_assign_tsnfunction sctp_process_missing_paramfunction sctp_process_inv_mandatoryfunction sctp_process_inv_paramlengthfunction sctp_process_hn_paramfunction sctp_verify_ext_paramfunction sctp_process_ext_paramfunction sctp_process_unk_paramfunction sctp_verify_paramfunction sctp_verify_initfunction sctp_walk_paramsfunction sctp_process_initfunction ntohsfunction highfunction sctp_process_paramfunction sctp_generate_tagfunction sctp_generate_tsnfunction sctp_add_asconf_responsefunction sctp_process_asconf_paramfunction sctp_verify_asconffunction sctp_asconf_param_successfunction list_for_each_entryfunction list_for_each_entryfunction list_for_each_entryfunction sctp_get_asconf_responsefunction sctp_process_asconf_ackfunction sctp_verify_reconf
Annotated Snippet
struct __sctp_missing {
__be32 num_missing;
__be16 type;
} __packed;
/*
* Report a missing mandatory parameter.
*/
static int sctp_process_missing_param(const struct sctp_association *asoc,
enum sctp_param paramtype,
struct sctp_chunk *chunk,
struct sctp_chunk **errp)
{
struct __sctp_missing report;
__u16 len;
len = SCTP_PAD4(sizeof(report));
/* Make an ERROR chunk, preparing enough room for
* returning multiple unknown parameters.
*/
if (!*errp)
*errp = sctp_make_op_error_space(asoc, chunk, len);
if (*errp) {
report.num_missing = htonl(1);
report.type = paramtype;
sctp_init_cause(*errp, SCTP_ERROR_MISS_PARAM,
sizeof(report));
sctp_addto_chunk(*errp, sizeof(report), &report);
}
/* Stop processing this chunk. */
return 0;
}
/* Report an Invalid Mandatory Parameter. */
static int sctp_process_inv_mandatory(const struct sctp_association *asoc,
struct sctp_chunk *chunk,
struct sctp_chunk **errp)
{
/* Invalid Mandatory Parameter Error has no payload. */
if (!*errp)
*errp = sctp_make_op_error_space(asoc, chunk, 0);
if (*errp)
sctp_init_cause(*errp, SCTP_ERROR_INV_PARAM, 0);
/* Stop processing this chunk. */
return 0;
}
static int sctp_process_inv_paramlength(const struct sctp_association *asoc,
struct sctp_paramhdr *param,
const struct sctp_chunk *chunk,
struct sctp_chunk **errp)
{
/* This is a fatal error. Any accumulated non-fatal errors are
* not reported.
*/
if (*errp)
sctp_chunk_free(*errp);
/* Create an error chunk and fill it in with our payload. */
*errp = sctp_make_violation_paramlen(asoc, chunk, param);
return 0;
}
/* Do not attempt to handle the HOST_NAME parm. However, do
* send back an indicator to the peer.
*/
static int sctp_process_hn_param(const struct sctp_association *asoc,
union sctp_params param,
struct sctp_chunk *chunk,
struct sctp_chunk **errp)
{
__u16 len = ntohs(param.p->length);
/* Processing of the HOST_NAME parameter will generate an
* ABORT. If we've accumulated any non-fatal errors, they
* would be unrecognized parameters and we should not include
* them in the ABORT.
*/
if (*errp)
sctp_chunk_free(*errp);
*errp = sctp_make_op_error(asoc, chunk, SCTP_ERROR_DNS_FAILED,
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/scatterlist.h`.
- Detected declarations: `struct __sctp_missing`, `function sctp_control_release_owner`, `function sctp_control_set_owner_w`, `function sctp_init_cause`, `function Address`, `function INIT`, `function min`, `function sctp_init_addrs`, `function sctp_chunk_destroy`, `function sctp_chunk_free`.
- 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.