net/wireless/wext-compat.c
Source file repositories/reference/linux-study-clean/net/wireless/wext-compat.c
File Facts
- System
- Linux kernel
- Corpus path
net/wireless/wext-compat.c- Extension
.c- Size
- 39723 bytes
- Lines
- 1524
- 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.
- 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/export.hlinux/wireless.hlinux/nl80211.hlinux/if_arp.hlinux/etherdevice.hlinux/slab.hlinux/string.hnet/iw_handler.hnet/cfg80211.hnet/cfg80211-wext.hwext-compat.hcore.hrdev-ops.h
Detected Declarations
function Copyrightfunction cfg80211_wext_siwmodefunction cfg80211_wext_giwmodefunction cfg80211_wext_giwrangefunction cfg80211_wext_freqfunction cfg80211_wext_siwrtsfunction cfg80211_wext_giwrtsfunction cfg80211_wext_siwfragfunction cfg80211_wext_giwfragfunction cfg80211_wext_siwretryfunction cfg80211_wext_giwretryfunction cfg80211_set_encryptionfunction cfg80211_wext_siwencodefunction cfg80211_wext_siwencodeextfunction cfg80211_wext_giwencodefunction cfg80211_wext_siwfreqfunction cfg80211_wext_giwfreqfunction cfg80211_wext_siwtxpowerfunction cfg80211_wext_giwtxpowerfunction scoped_guardfunction cfg80211_set_auth_algfunction cfg80211_set_wpa_versionfunction cfg80211_set_cipher_groupfunction cfg80211_set_cipher_pairwisefunction cfg80211_set_key_mgtfunction cfg80211_wext_siwauthfunction cfg80211_wext_giwauthfunction cfg80211_wext_siwpowerfunction cfg80211_wext_giwpowerfunction cfg80211_wext_siwratefunction cfg80211_wext_giwratefunction scoped_guardfunction cfg80211_wext_siwapfunction cfg80211_wext_giwapfunction cfg80211_wext_siwessidfunction cfg80211_wext_giwessidfunction cfg80211_wext_siwpmksa
Annotated Snippet
switch (wdev->wiphy->cipher_suites[i]) {
case WLAN_CIPHER_SUITE_TKIP:
range->enc_capa |= (IW_ENC_CAPA_CIPHER_TKIP |
IW_ENC_CAPA_WPA);
break;
case WLAN_CIPHER_SUITE_CCMP:
range->enc_capa |= (IW_ENC_CAPA_CIPHER_CCMP |
IW_ENC_CAPA_WPA2);
break;
case WLAN_CIPHER_SUITE_WEP40:
range->encoding_size[range->num_encoding_sizes++] =
WLAN_KEY_LEN_WEP40;
break;
case WLAN_CIPHER_SUITE_WEP104:
range->encoding_size[range->num_encoding_sizes++] =
WLAN_KEY_LEN_WEP104;
break;
}
}
for (band = 0; band < NUM_NL80211_BANDS; band ++) {
struct ieee80211_supported_band *sband;
sband = wdev->wiphy->bands[band];
if (!sband)
continue;
for (i = 0; i < sband->n_channels && c < IW_MAX_FREQUENCIES; i++) {
struct ieee80211_channel *chan = &sband->channels[i];
if (!(chan->flags & IEEE80211_CHAN_DISABLED)) {
range->freq[c].i =
ieee80211_frequency_to_channel(
chan->center_freq);
range->freq[c].m = chan->center_freq;
range->freq[c].e = 6;
c++;
}
}
}
range->num_channels = c;
range->num_frequency = c;
IW_EVENT_CAPA_SET_KERNEL(range->event_capa);
IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP);
IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN);
if (wdev->wiphy->max_scan_ssids > 0)
range->scan_capa |= IW_SCAN_CAPA_ESSID;
return 0;
}
/**
* cfg80211_wext_freq - get wext frequency for non-"auto"
* @freq: the wext freq encoding
*
* Returns: a frequency, or a negative error code, or 0 for auto.
*/
int cfg80211_wext_freq(struct iw_freq *freq)
{
/*
* Parse frequency - return 0 for auto and
* -EINVAL for impossible things.
*/
if (freq->e == 0) {
enum nl80211_band band = NL80211_BAND_2GHZ;
if (freq->m < 0)
return 0;
if (freq->m > 14)
band = NL80211_BAND_5GHZ;
return ieee80211_channel_to_frequency(freq->m, band);
} else {
int i, div = 1000000;
for (i = 0; i < freq->e; i++)
div /= 10;
if (div <= 0)
return -EINVAL;
return freq->m / div;
}
}
int cfg80211_wext_siwrts(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
Annotation
- Immediate include surface: `linux/export.h`, `linux/wireless.h`, `linux/nl80211.h`, `linux/if_arp.h`, `linux/etherdevice.h`, `linux/slab.h`, `linux/string.h`, `net/iw_handler.h`.
- Detected declarations: `function Copyright`, `function cfg80211_wext_siwmode`, `function cfg80211_wext_giwmode`, `function cfg80211_wext_giwrange`, `function cfg80211_wext_freq`, `function cfg80211_wext_siwrts`, `function cfg80211_wext_giwrts`, `function cfg80211_wext_siwfrag`, `function cfg80211_wext_giwfrag`, `function cfg80211_wext_siwretry`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
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.