I want to learn about how nl80211
and cfg80211
works in detail. Function flow, how nl80211
interact with network tools like wpa_supplicant
, iw
.
Plz suggest me some useful links or books to refer.
nl80211 is the interface between user space software ( iw , wpa_supplicant , etc.) and the kernel ( cfg80211 and mac80211 kernel modules, and specific drivers). The WiFi drivers and hardware could be Full-MAC or Soft-MAC (see Wireless_network_interface_controller).
mac80211 is the Linux stack for 802.11 hardware that implements only partial functionality in hard- or firmware. This document defines the interface between mac80211 and low-level hardware drivers.
To be able to control wireless drivers from userspace, some IPC communication processes between kernel and userspace are used.
ioctl
with vendor dependent APIs was used.The Wireless Extension (WE) is a generic API allowing a driver to expose to the user space configuration and statistics specific to common Wireless LANs.
In 2006, John Linville creates mac80211 and Johannes Berg creates cfg80211 and nl80211. Together it is intended to replace wireless extensions.
+-------------+ | | | Userspace | | | +-------------+ ^ - - - | - - - - | nl80211 v +-------------+ | | | cfg80211 | | | +-------------+ +-------------+ | | | mac80211 | | driver | | | +-------------+
An important point is that nl80211/cfg80211/mac80211 no longer use ioctl, they use netlink.
So, tools like iw, hostapd or the wpa_supplicant use some netlink libraries (like libnl or libnl-tiny) and the netlink interface public header which is of course nl80211.h.
There is not so much documentations, but I advise you to read the libnl documentation and then the iw source code (because iw use libnl).
A slightly more detailed picture of how nl80211
and cfg80211
work with other parts of the system (user space
, kernel
, and hardware
).
nl80211
is the interface between user space software (iw
, wpa_supplicant
, etc.) and the kernel (cfg80211
and mac80211
kernel modules, and specific drivers). cfg80211_ops
is a set of operations that Full-MAC drivers and mac80211
module register to cfg80211
module.ieee80211_ops
is a set of operations that Soft-MAC drivers register to mac80211
module.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With