net/sctp/sysctl.c
Source file repositories/reference/linux-study-clean/net/sctp/sysctl.c
File Facts
- System
- Linux kernel
- Corpus path
net/sctp/sysctl.c- Extension
.c- Size
- 16554 bytes
- Lines
- 638
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
net/sctp/structs.hnet/sctp/sctp.hlinux/sysctl.h
Detected Declarations
function proc_sctp_do_hmac_algfunction proc_sctp_do_rto_minfunction proc_sctp_do_rto_maxfunction proc_sctp_do_alpha_betafunction proc_sctp_do_authfunction proc_sctp_do_udp_portfunction proc_sctp_do_probe_intervalfunction sctp_sysctl_net_registerfunction sctp_sysctl_net_unregisterfunction sctp_sysctl_registerfunction sctp_sysctl_unregister
Annotated Snippet
if (!strcmp(tmp, "sha256")) {
net->sctp.cookie_auth_enable = 1;
return 0;
}
if (!strcmp(tmp, "none")) {
net->sctp.cookie_auth_enable = 0;
return 0;
}
return -EINVAL;
}
if (net->sctp.cookie_auth_enable)
tbl.data = (char *)"sha256";
else
tbl.data = (char *)"none";
tbl.maxlen = strlen(tbl.data);
return proc_dostring(&tbl, 0, buffer, lenp, ppos);
}
static int proc_sctp_do_rto_min(const struct ctl_table *ctl, int write,
void *buffer, size_t *lenp, loff_t *ppos)
{
struct net *net = container_of(ctl->data, struct net, sctp.rto_min);
unsigned int min = *(unsigned int *) ctl->extra1;
unsigned int max = *(unsigned int *) ctl->extra2;
struct ctl_table tbl;
int ret, new_value;
memset(&tbl, 0, sizeof(struct ctl_table));
tbl.maxlen = sizeof(unsigned int);
if (write)
tbl.data = &new_value;
else
tbl.data = &net->sctp.rto_min;
ret = proc_dointvec(&tbl, write, buffer, lenp, ppos);
if (write && ret == 0) {
if (new_value > max || new_value < min)
return -EINVAL;
net->sctp.rto_min = new_value;
}
return ret;
}
static int proc_sctp_do_rto_max(const struct ctl_table *ctl, int write,
void *buffer, size_t *lenp, loff_t *ppos)
{
struct net *net = container_of(ctl->data, struct net, sctp.rto_max);
unsigned int min = *(unsigned int *) ctl->extra1;
unsigned int max = *(unsigned int *) ctl->extra2;
struct ctl_table tbl;
int ret, new_value;
memset(&tbl, 0, sizeof(struct ctl_table));
tbl.maxlen = sizeof(unsigned int);
if (write)
tbl.data = &new_value;
else
tbl.data = &net->sctp.rto_max;
ret = proc_dointvec(&tbl, write, buffer, lenp, ppos);
if (write && ret == 0) {
if (new_value > max || new_value < min)
return -EINVAL;
net->sctp.rto_max = new_value;
}
return ret;
}
static int proc_sctp_do_alpha_beta(const struct ctl_table *ctl, int write,
void *buffer, size_t *lenp, loff_t *ppos)
{
if (write)
pr_warn_once("Changing rto_alpha or rto_beta may lead to "
"suboptimal rtt/srtt estimations!\n");
return proc_dointvec_minmax(ctl, write, buffer, lenp, ppos);
}
static int proc_sctp_do_auth(const struct ctl_table *ctl, int write,
void *buffer, size_t *lenp, loff_t *ppos)
{
struct net *net = container_of(ctl->data, struct net, sctp.auth_enable);
struct ctl_table tbl;
int new_value, ret;
Annotation
- Immediate include surface: `net/sctp/structs.h`, `net/sctp/sctp.h`, `linux/sysctl.h`.
- Detected declarations: `function proc_sctp_do_hmac_alg`, `function proc_sctp_do_rto_min`, `function proc_sctp_do_rto_max`, `function proc_sctp_do_alpha_beta`, `function proc_sctp_do_auth`, `function proc_sctp_do_udp_port`, `function proc_sctp_do_probe_interval`, `function sctp_sysctl_net_register`, `function sctp_sysctl_net_unregister`, `function sctp_sysctl_register`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.