net/wireless/nl80211.c
Source file repositories/reference/linux-study-clean/net/wireless/nl80211.c
File Facts
- System
- Linux kernel
- Corpus path
net/wireless/nl80211.c- Extension
.c- Size
- 656798 bytes
- Lines
- 23447
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/if.hlinux/module.hlinux/err.hlinux/slab.hlinux/list.hlinux/if_ether.hlinux/ieee80211.hlinux/nl80211.hlinux/rtnetlink.hlinux/netlink.hlinux/nospec.hlinux/etherdevice.hlinux/if_vlan.hlinux/random.hnet/net_namespace.hnet/genetlink.hnet/cfg80211.hnet/sock.hnet/inet_connection_sock.hcore.hnl80211.hreg.hrdev-ops.h
Detected Declarations
struct key_parsestruct nl80211_dump_wiphy_statestruct get_key_cookiestruct nl80211_mlme_eventenum nl80211_multicast_groupsenum nl80211_internal_flags_selectorfunction __cfg80211_wdev_from_attrsfunction list_for_each_entryfunction for_each_rdevfunction list_for_each_entryfunction __cfg80211_rdev_from_attrsfunction IS_ERRfunction validate_beacon_headfunction for_each_elementfunction validate_ie_attrfunction for_each_elementfunction validate_he_capafunction validate_supported_selectorsfunction validate_nan_cluster_idfunction validate_nan_avail_blobfunction validate_nan_ulwfunction validate_uhr_capafunction validate_uhr_operationfunction nl80211_prepare_wdev_dumpfunction __cfg80211_wdev_from_attrsfunction list_for_each_entryfunction nl80211_msg_put_wmm_rulesfunction nl80211_msg_put_channelfunction nl80211_put_txq_statsfunction nl80211_link_idfunction nl80211_link_id_or_invalidfunction nl80211_parse_key_newfunction nl80211_parse_key_oldfunction nl80211_parse_keyfunction nl80211_parse_connkeysfunction nla_for_each_nestedfunction nla_for_each_nestedfunction nl80211_key_allowedfunction nl80211_put_iftypesfunction nl80211_put_ifcomb_datafunction nl80211_put_iface_combinationsfunction nl80211_send_wowlan_tcp_capsfunction nl80211_send_wowlanfunction nl80211_send_coalescefunction nl80211_send_iftype_datafunction nl80211_send_band_rateinfofunction for_each_sband_iftype_datafunction nl80211_send_mgmt_stypes
Annotated Snippet
struct key_parse {
struct key_params p;
int idx;
int type;
bool def, defmgmt, defbeacon;
bool def_uni, def_multi;
};
static int nl80211_parse_key_new(struct genl_info *info, struct nlattr *key,
struct key_parse *k)
{
struct nlattr *tb[NL80211_KEY_MAX + 1];
int err = nla_parse_nested_deprecated(tb, NL80211_KEY_MAX, key,
nl80211_key_policy,
info->extack);
if (err)
return err;
k->def = !!tb[NL80211_KEY_DEFAULT];
k->defmgmt = !!tb[NL80211_KEY_DEFAULT_MGMT];
k->defbeacon = !!tb[NL80211_KEY_DEFAULT_BEACON];
if (k->def) {
k->def_uni = true;
k->def_multi = true;
}
if (k->defmgmt || k->defbeacon)
k->def_multi = true;
if (tb[NL80211_KEY_IDX])
k->idx = nla_get_u8(tb[NL80211_KEY_IDX]);
if (tb[NL80211_KEY_DATA]) {
k->p.key = nla_data(tb[NL80211_KEY_DATA]);
k->p.key_len = nla_len(tb[NL80211_KEY_DATA]);
}
if (tb[NL80211_KEY_SEQ]) {
k->p.seq = nla_data(tb[NL80211_KEY_SEQ]);
k->p.seq_len = nla_len(tb[NL80211_KEY_SEQ]);
}
if (tb[NL80211_KEY_CIPHER])
k->p.cipher = nla_get_u32(tb[NL80211_KEY_CIPHER]);
if (tb[NL80211_KEY_TYPE])
k->type = nla_get_u32(tb[NL80211_KEY_TYPE]);
if (tb[NL80211_KEY_DEFAULT_TYPES]) {
struct nlattr *kdt[NUM_NL80211_KEY_DEFAULT_TYPES];
err = nla_parse_nested_deprecated(kdt,
NUM_NL80211_KEY_DEFAULT_TYPES - 1,
tb[NL80211_KEY_DEFAULT_TYPES],
nl80211_key_default_policy,
info->extack);
if (err)
return err;
k->def_uni = kdt[NL80211_KEY_DEFAULT_TYPE_UNICAST];
k->def_multi = kdt[NL80211_KEY_DEFAULT_TYPE_MULTICAST];
}
if (tb[NL80211_KEY_MODE])
k->p.mode = nla_get_u8(tb[NL80211_KEY_MODE]);
if (tb[NL80211_KEY_LTF_SEED]) {
k->p.ltf_keyseed = nla_data(tb[NL80211_KEY_LTF_SEED]);
k->p.ltf_keyseed_len = nla_len(tb[NL80211_KEY_LTF_SEED]);
}
return 0;
}
static int nl80211_parse_key_old(struct genl_info *info, struct key_parse *k)
{
if (info->attrs[NL80211_ATTR_KEY_DATA]) {
k->p.key = nla_data(info->attrs[NL80211_ATTR_KEY_DATA]);
k->p.key_len = nla_len(info->attrs[NL80211_ATTR_KEY_DATA]);
}
if (info->attrs[NL80211_ATTR_KEY_SEQ]) {
k->p.seq = nla_data(info->attrs[NL80211_ATTR_KEY_SEQ]);
k->p.seq_len = nla_len(info->attrs[NL80211_ATTR_KEY_SEQ]);
}
if (info->attrs[NL80211_ATTR_KEY_IDX])
k->idx = nla_get_u8(info->attrs[NL80211_ATTR_KEY_IDX]);
if (info->attrs[NL80211_ATTR_KEY_CIPHER])
Annotation
- Immediate include surface: `linux/if.h`, `linux/module.h`, `linux/err.h`, `linux/slab.h`, `linux/list.h`, `linux/if_ether.h`, `linux/ieee80211.h`, `linux/nl80211.h`.
- Detected declarations: `struct key_parse`, `struct nl80211_dump_wiphy_state`, `struct get_key_cookie`, `struct nl80211_mlme_event`, `enum nl80211_multicast_groups`, `enum nl80211_internal_flags_selector`, `function __cfg80211_wdev_from_attrs`, `function list_for_each_entry`, `function for_each_rdev`, `function list_for_each_entry`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.