net/wireless/wext-core.c
Source file repositories/reference/linux-study-clean/net/wireless/wext-core.c
File Facts
- System
- Linux kernel
- Corpus path
net/wireless/wext-core.c- Extension
.c- Size
- 33236 bytes
- Lines
- 1219
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/kernel.hlinux/netdevice.hlinux/rtnetlink.hlinux/slab.hlinux/wireless.hlinux/uaccess.hlinux/export.hnet/cfg80211.hnet/iw_handler.hnet/netlink.hnet/wext.hnet/net_namespace.h
Detected Declarations
function wireless_nlevent_flushfunction wext_netdev_notifier_callfunction wext_pernet_initfunction wext_pernet_exitfunction wireless_nlevent_initfunction wireless_nlevent_processfunction wireless_send_eventfunction wireless_warn_cfg80211_wextfunction iw_handler_get_iwstatsfunction get_handlerfunction ioctl_standard_iw_pointfunction call_commit_handlerfunction wireless_process_ioctlfunction wext_permission_checkfunction wext_ioctl_dispatchfunction ioctl_standard_callfunction wext_handle_ioctlfunction compat_standard_callfunction compat_wext_handle_ioctlmodule init wireless_nlevent_initexport wireless_nlevent_flushexport wireless_send_eventexport iwe_stream_add_eventexport iwe_stream_add_pointexport iwe_stream_add_value
Annotated Snippet
subsys_initcall(wireless_nlevent_init);
/* Process events generated by the wireless layer or the driver. */
static void wireless_nlevent_process(struct work_struct *work)
{
wireless_nlevent_flush();
}
static DECLARE_WORK(wireless_nlevent_work, wireless_nlevent_process);
static struct nlmsghdr *rtnetlink_ifinfo_prep(struct net_device *dev,
struct sk_buff *skb)
{
struct ifinfomsg *r;
struct nlmsghdr *nlh;
nlh = nlmsg_put(skb, 0, 0, RTM_NEWLINK, sizeof(*r), 0);
if (!nlh)
return NULL;
r = nlmsg_data(nlh);
r->ifi_family = AF_UNSPEC;
r->__ifi_pad = 0;
r->ifi_type = dev->type;
r->ifi_index = dev->ifindex;
r->ifi_flags = netif_get_flags(dev);
r->ifi_change = 0; /* Wireless changes don't affect those flags */
if (nla_put_string(skb, IFLA_IFNAME, dev->name))
goto nla_put_failure;
return nlh;
nla_put_failure:
nlmsg_cancel(skb, nlh);
return NULL;
}
/*
* Main event dispatcher. Called from other parts and drivers.
* Send the event on the appropriate channels.
* May be called from interrupt context.
*/
void wireless_send_event(struct net_device * dev,
unsigned int cmd,
union iwreq_data * wrqu,
const char * extra)
{
const struct iw_ioctl_description * descr = NULL;
int extra_len = 0;
struct iw_event *event; /* Mallocated whole event */
int event_len; /* Its size */
int hdr_len; /* Size of the event header */
int wrqu_off = 0; /* Offset in wrqu */
/* Don't "optimise" the following variable, it will crash */
unsigned int cmd_index; /* *MUST* be unsigned */
struct sk_buff *skb;
struct nlmsghdr *nlh;
struct nlattr *nla;
#ifdef CONFIG_COMPAT
struct __compat_iw_event *compat_event;
struct compat_iw_point compat_wrqu;
struct sk_buff *compskb;
int ptr_len;
#endif
/*
* Nothing in the kernel sends scan events with data, be safe.
* This is necessary because we cannot fix up scan event data
* for compat, due to being contained in 'extra', but normally
* applications are required to retrieve the scan data anyway
* and no data is included in the event, this codifies that
* practice.
*/
if (WARN_ON(cmd == SIOCGIWSCAN && extra))
extra = NULL;
/* Get the description of the Event */
if (cmd <= SIOCIWLAST) {
cmd_index = IW_IOCTL_IDX(cmd);
if (cmd_index < standard_ioctl_num)
descr = &(standard_ioctl[cmd_index]);
} else {
cmd_index = IW_EVENT_IDX(cmd);
if (cmd_index < standard_event_num)
descr = &(standard_event[cmd_index]);
}
/* Don't accept unknown events */
if (descr == NULL) {
/* Note : we don't return an error to the driver, because
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/netdevice.h`, `linux/rtnetlink.h`, `linux/slab.h`, `linux/wireless.h`, `linux/uaccess.h`, `linux/export.h`, `net/cfg80211.h`.
- Detected declarations: `function wireless_nlevent_flush`, `function wext_netdev_notifier_call`, `function wext_pernet_init`, `function wext_pernet_exit`, `function wireless_nlevent_init`, `function wireless_nlevent_process`, `function wireless_send_event`, `function wireless_warn_cfg80211_wext`, `function iw_handler_get_iwstats`, `function get_handler`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: integration implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.