How aosp/wpa_supplicant_8 works
Project type and purpose
• This is a system-level, C-language suite providing Wi-Fi authentication services:
– hostapd: Access Point (AP) daemon implementing WPA/WPA2/WPS/HS2.0/P2P on the AP side
– wpa_supplicant: Client/Supplicant daemon implementing WPA/WPA2/WPS/HS2.0/P2P on the station side
• It is not a web app or microservices system but a monolithic, plugin-based networking daemon with a rich internal architecture.
File structure
• Top-level directories:
– hostapd/ and wpa_supplicant/: each contains the build configuration, main.c, control interfaces, protocol handlers, example configs and scripts
– src/: common code shared by both daemons, organized into subdirectories for ap (hostapd core), common, crypto, drivers, eap_common, eap_peer, eap_server, p2p, utils, tls, wps, radius, etc.
– hs20/: Hotspot 2.0 specific client/server examples and CA tools
• Patterns:
– Modular plugins for EAP methods, TLS back-ends, drivers, P2P, WPS
– Clear layering: core daemon ← protocol stacks (EAP, IEEE802.11) ← crypto & TLS libs ← OS driver interface ← kernel/firmware
– Control interfaces: Unix sockets, named pipes, UDP, Windows named pipes, DBus
Key insights from README
• Two separate build targets (hostapd and wpa_supplicant) sharing the same codebase via src/
• Build by entering the respective subdirectory, generating .config, then make
• BSD licensing, contributions guidelines
Main components
– hostapd daemon process
• ap core (src/ap/)
• IEEE802.11 authentication/state machines
• EAP-server modules (src/eap_server/)
• RADIUS client (src/radius/)
• WPS/P2P handling (src/wps/, src/p2p/)
• Control interface (hostapd/ctrl_iface.c, DBus, CLI)
• Driver abstraction layer (src/drivers/) → kernel via nl80211/hostap/…
– wpa_supplicant daemon process
• supplicant core (wpa_supplicant/*.c)
• EAP-peer modules (src/eap_peer/)
• IEEE802.11 state machines and WPA authenticator stub
• WPS/P2P handling
• Control interface (wpa_cli, DBus)
• Driver abstraction layer (src/drivers/)
– Shared libraries/layers
• Crypto/TLS (src/crypto/, src/tls/) – AES, SHA, RSA, PKCS#…
• Common helpers (src/common/, src/utils/) – state machine, event loop, logging, base64, XML, HTTP utils
– External services
• RADIUS Authentication/Accounting servers
• Certificate Authority (for HS2.0 EST)
• GUI/CLI front-ends (wpa_cli, wpa_gui, hostapd_cli)
• DBus clients (network managers)
Relationships and data flows
• Driver calls ←→ daemon core (Rx/Tx packets, ioctl/NETLINK)
• Daemon core ←→ Crypto/TLS library (EAP-TLS handshakes)
• Daemon core ←→ EAP modules ←→ RADIUS client/server over UDP
• Control interface ←→ daemon core (configuration reload, status queries)
• GUI/CLI/DBus ←→ control interface ←→ daemon core
• HS2.0 CA tools ←→ server-side components via HTTPS/EST
Architectural patterns and principles
• Layered modular architecture: keep protocol logic, crypto, drivers separate
• Plugin pattern: EAP, TLS, driver back-ends built/loaded as modules
• Event-driven core (eloop) for non-blocking I/O
• Abstraction of platform differences (Linux/Windows/Android/FreeBSD) via os_*.c and l2_packet