net/mptcp/ctrl.c
Source file repositories/reference/linux-study-clean/net/mptcp/ctrl.c
File Facts
- System
- Linux kernel
- Corpus path
net/mptcp/ctrl.c- Extension
.c- Size
- 15016 bytes
- Lines
- 606
- 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.
- 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
linux/sysctl.hnet/net_namespace.hnet/netns/generic.hprotocol.hmib.h
Detected Declarations
struct mptcp_pernetfunction mptcp_is_enabledfunction mptcp_get_add_addr_timeoutfunction mptcp_is_checksum_enabledfunction mptcp_allow_join_id0function mptcp_stale_loss_cntfunction mptcp_close_timeoutfunction mptcp_get_pm_typefunction mptcp_add_addr_v6_port_drop_tsfunction mptcp_pernet_set_defaultsfunction mptcp_set_schedulerfunction proc_schedulerfunction proc_available_schedulersfunction proc_blackhole_detect_timeoutfunction mptcp_set_path_managerfunction proc_path_managerfunction proc_pm_typefunction proc_available_path_managersfunction mptcp_pernet_new_tablefunction mptcp_pernet_del_tablefunction mptcp_pernet_new_tablefunction mptcp_pernet_del_tablefunction mptcp_active_should_disablefunction mptcp_active_enablefunction mptcp_active_detect_blackholefunction mptcp_net_initfunction mptcp_net_exitfunction mptcp_initfunction mptcpv6_init
Annotated Snippet
struct mptcp_pernet {
#ifdef CONFIG_SYSCTL
struct ctl_table_header *ctl_table_hdr;
#endif
unsigned int add_addr_timeout;
unsigned int blackhole_timeout;
unsigned int close_timeout;
unsigned int stale_loss_cnt;
atomic_t active_disable_times;
unsigned long active_disable_stamp;
u8 syn_retrans_before_tcp_fallback;
u8 mptcp_enabled;
u8 checksum_enabled;
u8 allow_join_initial_addr_port;
u8 pm_type;
u8 add_addr_v6_port_drop_ts;
char scheduler[MPTCP_SCHED_NAME_MAX];
char path_manager[MPTCP_PM_NAME_MAX];
};
static struct mptcp_pernet *mptcp_get_pernet(const struct net *net)
{
return net_generic(net, mptcp_pernet_id);
}
int mptcp_is_enabled(const struct net *net)
{
return mptcp_get_pernet(net)->mptcp_enabled;
}
unsigned int mptcp_get_add_addr_timeout(const struct net *net)
{
return mptcp_get_pernet(net)->add_addr_timeout;
}
int mptcp_is_checksum_enabled(const struct net *net)
{
return mptcp_get_pernet(net)->checksum_enabled;
}
int mptcp_allow_join_id0(const struct net *net)
{
return mptcp_get_pernet(net)->allow_join_initial_addr_port;
}
unsigned int mptcp_stale_loss_cnt(const struct net *net)
{
return mptcp_get_pernet(net)->stale_loss_cnt;
}
unsigned int mptcp_close_timeout(const struct sock *sk)
{
if (sock_flag(sk, SOCK_DEAD))
return TCP_TIMEWAIT_LEN;
return mptcp_get_pernet(sock_net(sk))->close_timeout;
}
int mptcp_get_pm_type(const struct net *net)
{
return mptcp_get_pernet(net)->pm_type;
}
const char *mptcp_get_path_manager(const struct net *net)
{
return mptcp_get_pernet(net)->path_manager;
}
const char *mptcp_get_scheduler(const struct net *net)
{
return mptcp_get_pernet(net)->scheduler;
}
unsigned int mptcp_add_addr_v6_port_drop_ts(const struct net *net)
{
return READ_ONCE(mptcp_get_pernet(net)->add_addr_v6_port_drop_ts);
}
static void mptcp_pernet_set_defaults(struct mptcp_pernet *pernet)
{
pernet->mptcp_enabled = 1;
pernet->add_addr_timeout = TCP_RTO_MAX;
pernet->blackhole_timeout = 3600;
pernet->syn_retrans_before_tcp_fallback = 2;
atomic_set(&pernet->active_disable_times, 0);
pernet->close_timeout = TCP_TIMEWAIT_LEN;
pernet->checksum_enabled = 0;
pernet->allow_join_initial_addr_port = 1;
pernet->stale_loss_cnt = 4;
pernet->pm_type = MPTCP_PM_TYPE_KERNEL;
Annotation
- Immediate include surface: `linux/sysctl.h`, `net/net_namespace.h`, `net/netns/generic.h`, `protocol.h`, `mib.h`.
- Detected declarations: `struct mptcp_pernet`, `function mptcp_is_enabled`, `function mptcp_get_add_addr_timeout`, `function mptcp_is_checksum_enabled`, `function mptcp_allow_join_id0`, `function mptcp_stale_loss_cnt`, `function mptcp_close_timeout`, `function mptcp_get_pm_type`, `function mptcp_add_addr_v6_port_drop_ts`, `function mptcp_pernet_set_defaults`.
- 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.