include/net/net_namespace.h
Source file repositories/reference/linux-study-clean/include/net/net_namespace.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/net_namespace.h- Extension
.h- Size
- 15046 bytes
- Lines
- 595
- 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/atomic.hlinux/refcount.hlinux/workqueue.hlinux/list.hlinux/sysctl.hlinux/uidgid.hnet/flow.hnet/netns/core.hnet/netns/mib.hnet/netns/unix.hnet/netns/packet.hnet/netns/ipv4.hnet/netns/ipv6.hnet/netns/nexthop.hnet/netns/ieee802154_6lowpan.hnet/netns/sctp.hnet/netns/netfilter.hnet/netns/conntrack.hnet/netns/flow_table.hnet/netns/nftables.hnet/netns/xfrm.hnet/netns/mpls.hnet/netns/can.hnet/netns/xdp.hnet/netns/smc.hnet/netns/bpf.hnet/netns/mctp.hnet/netns/vsock.hnet/net_trackers.hlinux/ns_common.hlinux/idr.hlinux/skbuff.h
Detected Declarations
struct user_namespacestruct proc_dir_entrystruct net_devicestruct sockstruct ctl_table_headerstruct net_genericstruct uevent_sockstruct netns_ipvsstruct bpf_progstruct netstruct pernet_operationsstruct ctl_tablefunction net_ns_get_ownershipfunction net_ns_barrierfunction put_netfunction net_eqfunction check_netfunction put_netfunction net_eqfunction check_netfunction net_passive_decfunction net_passive_incfunction net_initializedfunction __netns_tracker_allocfunction netns_tracker_allocfunction __netns_tracker_freefunction put_net_trackfunction write_pnetfunction net_sysctl_initfunction unregister_net_sysctl_tablefunction rt_genid_ipv6function rt_genid_bump_ipv4function rt_genid_bump_ipv6function net_ieee802154_lowpanfunction rt_genid_bump_allfunction fnhe_genidfunction fnhe_genid_bumpfunction net_ns_init
Annotated Snippet
struct net {
/* First cache line can be often dirtied.
* Do not place here read-mostly fields.
*/
refcount_t passive; /* To decide when the network
* namespace should be freed.
*/
spinlock_t rules_mod_lock;
unsigned int dev_base_seq; /* protected by rtnl_mutex */
u32 ifindex;
spinlock_t nsid_lock;
atomic_t fnhe_genid;
struct list_head list; /* list of network namespaces */
struct list_head exit_list; /* To linked to call pernet exit
* methods on dead net (
* pernet_ops_rwsem read locked),
* or to unregister pernet ops
* (pernet_ops_rwsem write locked).
*/
struct llist_node defer_free_list;
struct llist_node cleanup_list; /* namespaces on death row */
struct list_head ptype_all;
struct list_head ptype_specific;
#ifdef CONFIG_KEYS
struct key_tag *key_domain; /* Key domain of operation tag */
#endif
struct user_namespace *user_ns; /* Owning user namespace */
struct ucounts *ucounts;
struct idr netns_ids;
struct ns_common ns;
struct ref_tracker_dir refcnt_tracker;
struct ref_tracker_dir notrefcnt_tracker; /* tracker for objects not
* refcounted against netns
*/
struct list_head dev_base_head;
struct proc_dir_entry *proc_net;
struct proc_dir_entry *proc_net_stat;
#ifdef CONFIG_SYSCTL
struct ctl_table_set sysctls;
#endif
struct sock *rtnl; /* rtnetlink socket */
struct sock *genl_sock;
struct uevent_sock *uevent_sock; /* uevent socket */
struct hlist_head *dev_name_head;
struct hlist_head *dev_index_head;
struct xarray dev_by_index;
struct raw_notifier_head netdev_chain;
/* Note that @hash_mix can be read millions times per second,
* it is critical that it is on a read_mostly cache line.
*/
u32 hash_mix;
bool is_dying;
struct net_device *loopback_dev; /* The loopback */
/* core fib_rules */
struct list_head rules_ops;
struct netns_core core;
struct netns_mib mib;
struct netns_packet packet;
#if IS_ENABLED(CONFIG_UNIX)
struct netns_unix unx;
#endif
struct netns_nexthop nexthop;
struct netns_ipv4 ipv4;
#if IS_ENABLED(CONFIG_IPV6)
struct netns_ipv6 ipv6;
#endif
#if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
struct netns_ieee802154_lowpan ieee802154_lowpan;
#endif
#if defined(CONFIG_IP_SCTP) || defined(CONFIG_IP_SCTP_MODULE)
struct netns_sctp sctp;
#endif
#ifdef CONFIG_NETFILTER
struct netns_nf nf;
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
struct netns_ct ct;
Annotation
- Immediate include surface: `linux/atomic.h`, `linux/refcount.h`, `linux/workqueue.h`, `linux/list.h`, `linux/sysctl.h`, `linux/uidgid.h`, `net/flow.h`, `net/netns/core.h`.
- Detected declarations: `struct user_namespace`, `struct proc_dir_entry`, `struct net_device`, `struct sock`, `struct ctl_table_header`, `struct net_generic`, `struct uevent_sock`, `struct netns_ipvs`, `struct bpf_prog`, `struct net`.
- 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.