include/net/inet_sock.h
Source file repositories/reference/linux-study-clean/include/net/inet_sock.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/inet_sock.h- Extension
.h- Size
- 11989 bytes
- Lines
- 454
- 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
linux/bitops.hlinux/string.hlinux/types.hlinux/jhash.hlinux/netdevice.hnet/flow.hnet/inet_dscp.hnet/sock.hnet/request_sock.hnet/netns/hash.hnet/tcp_states.hnet/l3mdev.h
Detected Declarations
struct ip_optionsstruct ip_options_rcustruct inet_request_sockstruct inet6_corkstruct inet_corkstruct inet_cork_fullstruct ip_mc_sockliststruct ipv6_pinfostruct rtablestruct inet_sockfunction inet_request_markfunction inet_request_bound_dev_iffunction inet_sk_bound_l3mdevfunction inet_bound_dev_eqfunction inet_sk_bound_dev_eqfunction inet_cmsg_flagsfunction inet_sk_dscpfunction inet_sk_state_storefunction __inet_ehashfnfunction inet_sk_flowi_flagsfunction inet_inc_convert_csumfunction inet_dec_convert_csumfunction inet_get_convert_csumfunction inet_can_nonlocal_bindfunction inet_addr_valid_or_nonlocal
Annotated Snippet
struct ip_options {
__be32 faddr;
__be32 nexthop;
unsigned char optlen;
unsigned char srr;
unsigned char rr;
unsigned char ts;
unsigned char is_strictroute:1,
srr_is_hit:1,
is_changed:1,
rr_needaddr:1,
ts_needtime:1,
ts_needaddr:1;
unsigned char router_alert;
unsigned char cipso;
unsigned char __pad2;
unsigned char __data[];
};
struct ip_options_rcu {
struct rcu_head rcu;
/* Must be last as it ends in a flexible-array member. */
struct ip_options opt;
};
struct inet_request_sock {
struct request_sock req;
#define ir_loc_addr req.__req_common.skc_rcv_saddr
#define ir_rmt_addr req.__req_common.skc_daddr
#define ir_num req.__req_common.skc_num
#define ir_rmt_port req.__req_common.skc_dport
#define ir_v6_rmt_addr req.__req_common.skc_v6_daddr
#define ir_v6_loc_addr req.__req_common.skc_v6_rcv_saddr
#define ir_iif req.__req_common.skc_bound_dev_if
#define ir_cookie req.__req_common.skc_cookie
#define ireq_net req.__req_common.skc_net
#define ireq_state req.__req_common.skc_state
#define ireq_family req.__req_common.skc_family
u16 snd_wscale : 4,
rcv_wscale : 4,
tstamp_ok : 1,
sack_ok : 1,
wscale_ok : 1,
ecn_ok : 1,
acked : 1,
no_srccheck: 1,
smc_ok : 1;
u32 ir_mark;
union {
struct ip_options_rcu __rcu *ireq_opt;
#if IS_ENABLED(CONFIG_IPV6)
struct {
struct ipv6_txoptions *ipv6_opt;
struct sk_buff *pktopts;
};
#endif
};
};
#define inet_rsk(ptr) container_of_const(ptr, struct inet_request_sock, req)
static inline u32 inet_request_mark(const struct sock *sk, struct sk_buff *skb)
{
u32 mark = READ_ONCE(sk->sk_mark);
if (!mark && READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_fwmark_accept))
return skb->mark;
return mark;
}
static inline int inet_request_bound_dev_if(const struct sock *sk,
struct sk_buff *skb)
{
int bound_dev_if = READ_ONCE(sk->sk_bound_dev_if);
#ifdef CONFIG_NET_L3_MASTER_DEV
struct net *net = sock_net(sk);
if (!bound_dev_if && READ_ONCE(net->ipv4.sysctl_tcp_l3mdev_accept))
return l3mdev_master_ifindex_by_index(net, skb->skb_iif);
#endif
return bound_dev_if;
}
static inline int inet_sk_bound_l3mdev(const struct sock *sk)
{
#ifdef CONFIG_NET_L3_MASTER_DEV
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/string.h`, `linux/types.h`, `linux/jhash.h`, `linux/netdevice.h`, `net/flow.h`, `net/inet_dscp.h`, `net/sock.h`.
- Detected declarations: `struct ip_options`, `struct ip_options_rcu`, `struct inet_request_sock`, `struct inet6_cork`, `struct inet_cork`, `struct inet_cork_full`, `struct ip_mc_socklist`, `struct ipv6_pinfo`, `struct rtable`, `struct inet_sock`.
- 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.