Connectivity & Media

Wi-Fi End-to-End

How Android joins a BSS on the control plane, then how every packet of an app's request travels from socket to AP to LAN and back through firmware, the wlan driver, eBPF and ConnectivityService. This is the hop-by-hop walk that Trace a Path Through the Android Stack only maps. Cellular packets stay on Android Data Call.

~85 min read 0 interview questions
In 30 seconds
  • Control plane joins the BSS (scan, associate, RSNA / 4-way, DHCP or SLAAC, NetworkAgent, validation). Data plane is every IP packet on wlan0 / wlan1 after that. Mixing the two is the usual interview fail.
  • The cake is App WifiManager / ConnectivityManager → WifiService (Wifi Mainline module in system_server) → wpa_supplicant + wificond + Wifi HAL (AIDL) → nl80211 → cfg80211 → mac80211 or a vendor full-MAC driver → firmware. hostapd is SoftAP, not STA.
  • A socket still gets an fwmark; ip rule sends that mark to this Network's table. Dual Wi-Fi + cellular, VPN and bindProcessToNetwork are the same policy story as on the data-call page — only the netdev family changes (wlan vs rmnet / CCMNI).
  • Uplink is app → bionic → TCP/IP → eBPF/fwmark → wlan driver → firmware AMPDU → AP → LAN/NAT → server. Downlink is not the reverse with the same interrupts: firmware + NAPI + GRO batch the AP's IRQs.
  • Validated Wi-Fi usually beats cellular for the default Network. Captive, unvalidated or "connected no internet" is assoc vs IP vs probe vs DNS vs UID firewall — almost never "the chip is broken."
  • Wi-Fi calling is IMS over this pipe (IWLAN / ePDG), not "just Wi-Fi." Do not conflate the 802.11 stack with Bluetooth.
  • Background scans, missing PNO/keepalive/TWT, and chatty sockets are why Wi-Fi drains in Doze. Firmware offload exists so the AP can sleep while the BSS stays up.

Two planes: control vs data

A Wi-Fi session is two conversations that share a radio and a kernel interface but almost no logic. Interviewers use this split as a filter. If you start an "HTTPS over Wi-Fi" answer with the 4-way handshake and never name fwmark, or you start with sk_buff and never mention association or NetworkAgent, you have mixed the planes.

Control plane (join the BSS)

  • Policy: Wi-Fi enabled, saved networks, auto-join, metered bit, carrier / enterprise restrictions.
  • 802.11 signalling: scan, authenticate, associate, RSNA (WPA2-PSK / WPA3-SAE / EAP), PMF, 4-way handshake, optional 802.11k/v/r.
  • Userspace: WifiService → wpa_supplicant + wificond + Wifi HAL (AIDL).
  • Result: associated BSSID, keys in firmware, wlan0 (or wlan1) up, IPv4/IPv6 from DHCP or SLAAC, DNS, MTU.
  • Framework finish: Wifi NetworkAgent into ConnectivityService; NetworkMonitor HTTPS probe; VALIDATED or captive.

Data plane (every IP packet)

  • App socket (OkHttp, HttpURLConnection, raw Socket, QUIC/UDP).
  • Kernel TCP/IP or UDP, netfilter/nftables, eBPF cgroup/skb, fwmark, policy routing.
  • wlan netdev ndo_start_xmit → driver → firmware (AMPDU, block ack, rate control).
  • Air: 802.11 data frames to the AP, then Ethernet on the LAN, NAT or routed, Internet, server — and the reverse.
  • No GTP-U, no PDN/PDU, no rmnet. That path is Android Data Call.
Analogy

Getting a badge and a locker at a gym versus actually swimming laps. The badge (control plane) is paperwork: find the club (scan), prove you belong (RSNA / 4-way), get a locker number (IP), and the front desk listing you as a member (NetworkAgent + validation). The laps (packets) never fill out that form again. Association is a different conversation from the HTTPS payload. See the map on Trace a Path Through the Android Stack; this page is the walk.

CONTROL (once per join / roam)                  DATA (every packet)
App / Settings / WifiConnectivityManager        App write/send / QUIC datagram
        |                                               |
WifiService (system_server, Wifi module)        ART / libcore / bionic
        |                                               |
wpa_supplicant + wificond + Wifi HAL            tcp_sendmsg / udp_sendmsg
        |                                               |
nl80211 / cfg80211 / driver / firmware          sk_buff + eBPF + fwmark
        |                                               |
Assoc + 4-way + DHCP/SLAAC                      wlan xmit + firmware AMPDU
        |                                               |
NetworkAgent + validation HTTPS probe           AP + LAN/NAT + server
        v                                               v
   "Network is usable"                          bytes on the air
Common pitfall Answering "trace a packet" with scan / WPA only, or answering "how does Wi-Fi come up?" with TCP and AMPDU only. Name both planes, then stay on the one the question asked.
Interview angle Open with one sentence per plane, then ask which they want. Framework ownership lives on Android frameworks. Binder to HAL and daemons: Binder & AIDL. Driver / NAPI: Linux Kernel & BSP. Wi-Fi calling is IMS on this pipe — IMS & VoLTE — not "the AP does VoLTE."

Layer cake: app to firmware

The Wi-Fi stack is a vertical cake. Apps never talk nl80211. Firmware never talks Binder. Learn who owns each hop and which IPC sits between them. The Wifi stack is a Mainline module (com.android.wifi APEX) on Android 13–15; WifiService still runs in system_server, loaded from that module. HIDL Wifi HAL exists on older devices; current AOSP is AIDL (android.hardware.wifi.IWifi, plus separate AIDL for supplicant and hostapd).

App process
  WifiManager / ConnectivityManager  (SDK / Binder)
        |
system_server  (Wifi Mainline module)
  WifiService / ClientModeManager / WifiConnectivityManager
  WifiNetworkAgent --> ConnectivityService
        |                         |
        |                    netd + Network stack
        |                    (addr, fwmark, DHCP/SLAAC via IpClient, validation)
        |
  +-----+-----+------------------+
  |           |                  |
wificond    wpa_supplicant     Wifi HAL (AIDL IWifi / IWifiChip / IWifiStaIface)
(nl80211    (SME: auth, assoc,  (chip mode, iface create, scan offload,
 scan/iface  4-way, keys, roam   RTT, NAN, energy, concurrent caps)
 events)     events)
        |           |
        +-----+-----+
              |
        nl80211 netlink
              |
        cfg80211  (kernel 802.11 configuration API)
              |
     mac80211 (softMAC)     OR     vendor full-MAC driver
              |                              |
              +--------------+---------------+
                             |
                      wlan firmware / PHY
                             |
                           the air
Analogy

WifiService is the concierge: it decides which club to join and when. wpa_supplicant is the lawyer who speaks 802.11 authentication. wificond is the runner who files scan paperwork with the kernel. The Wifi HAL is the chip vendor's front desk. cfg80211 is building code; mac80211 (or the vendor full-MAC driver) is the locksmith; firmware is the lock. hostapd is a different building: you became the club.

Who does what

HopProcess / placeJob
WifiManagerApp / SettingsScan, connect, SoftAP, Aware, locks. Binder to WifiService.
ConnectivityManagerApp / systemNetworkRequests, callbacks, bind, default Network. Does not run 802.11.
WifiServicesystem_server (Wifi module)Policy, saved networks, ClientMode / SoftAP managers, selector, score card, agent.
wpa_supplicantNative daemon (AIDL ISupplicant)STA SME: auth, assoc, RSNA, EAP, keys, much of roam / 11r / 11k/v handling.
wificondNative daemon (android.net.wifi.nl80211)Scan trigger/results, iface events, some monitor mode. Talks nl80211.
Wifi HALVendor process (AIDL IWifi)Chip bring-up, iface create (STA/AP/P2P/NAN), offload scans, RTT, energy info, concurrency.
hostapdNative daemon (AIDL IHostapd)SoftAP / hotspot BSS. Not on the STA path.
nl80211 / cfg80211KernelUserspace ↔ 802.11 configuration. Every modern Linux Wi-Fi stack sits here.
mac80211 or full-MACKernel driverSoftMAC: mac80211 runs MLME. Full-MAC (typical phone Qualcomm / MediaTek): firmware + vendor driver own MLME.
Firmware / PHYChipTime-critical MAC, rate control, AMPDU, offloads, TWT, wowlan.

Mainline Wifi module

On 13–15, Wifi is updatable independently of the vendor image. HAL + driver + firmware stay vendor. A "Wifi module drop fixed auto-join" is plausible; a module drop fixing a full-MAC hang is not — that is firmware/driver.

Three AIDL surfaces

Do not collapse them. IWifi is the chip. ISupplicant is wpa_supplicant. IHostapd is SoftAP. Binder mechanics: Binder & AIDL.

IpClient is not WifiService

DHCP, SLAAC, provisioning and much of link-property assembly live in the Network stack module's IpClient. Wifi owns L2; IpClient owns L3 bring-up after association.

Common pitfall "WifiService talks nl80211." It does not. wificond and the driver/HAL path do. Also: SoftAP is hostapd, not a second wpa_supplicant personality you can hand-wave.
Interview angle Draw the cake in 20 seconds, name the three AIDL surfaces, say Mainline Wifi vs vendor HAL/firmware, and say IpClient does DHCP. Then offer to go STA connect or packet path.

Scan, associate, RSNA, IP and validation

Control-plane join is a ladder. Skip a rung and you get "Wi-Fi connected" in casual speech with a different owner. The usual interview ask is this ladder, not a recitation of 802.11 management subtype numbers.

Analogy

Finding a restaurant (scan), walking in and showing ID (auth / assoc / RSNA), being seated and given a menu (IP), then the health inspector checking the kitchen (validation probe). You can be seated with no kitchen (IP, not VALIDATED). You can pass the inspector and still be refused service at your table (UID firewall). Those are different jobs.

Scan types

TypeWho runs itWhen
Full / broadcast scanwificond / HAL → firmwareSettings screen, first join, "see all SSIDs." Dwells many channels. Expensive.
Directed / specified SSIDSame path, SSID list in the requestKnown networks, faster reconnect. Still on-channel time.
Connected scanFirmware, often off-channel brieflyWhile associated; used for roam candidates. Can cause a short data glitch if the chip is not DBS.
PNO / NLO (preferred / network-list offload)Firmware while AP sleepsDisconnected, screen off, Doze. Firmware matches a list and wakes the AP. This is Preferred Network Offload.
Gscan / significant-change (HAL scan offload)Firmware bucketed scansBackground results without waking userspace every dwell. Names vary by HAL version; say "HAL/firmware scan offload" and confirm the AIDL on the build.

Single-scan results come back through wificond (and/or HAL callbacks) into WifiService. The selector (WifiNetworkSelector / related) picks a candidate from saved networks + score card + security + frequency. Auto-join is WifiConnectivityManager, not ConnectivityService — that name collision is an interview trap.

Association and RSNA

  1. Open / shared auth (legacy) 802.11 "authentication" here is almost a no-op on modern RSNA networks. Real security is RSN, not this frame's name.
  2. Association STA sends Assoc Request (caps, RSN IE, PMF, HT/VHT/HE/EHT IEs). AP answers Assoc Response with AID. You are "associated," not yet "have internet," and on WPA2/WPA3 you are not yet allowed to send data.
  3. RSNA Robust Security Network Association: AKM + pairwise/group ciphers advertised in the RSN IE.
  4. WPA2-PSK PMK is derived from the passphrase (PBKDF2). Then the 4-way handshake (EAPOL) between STA and AP derives PTK, confirms liveness, delivers GTK.
  5. WPA3-SAE Simultaneous Authentication of Equals (Dragonfly) first: commit/confirm, produces a fresh PMK resistant to offline dictionary attack on the air. Then a 4-way handshake as usual. PMF (802.11w) is mandatory.
  6. Enterprise (WPA2/WPA3-Enterprise) EAP inside 802.1X (TLS, PEAP, TTLS, …) yields a PMK; then 4-way. The RADIUS server is not on the phone.
  7. PMKSA caching Skip full SAE/EAP on reconnect to the same PMKID. 802.11r is the fast-BSS-transition cousin — see roam.
Scan --> (optional SAE commit/confirm) --> Auth --> Assoc
        --> EAPOL 4-way (PTK + GTK) --> keys in firmware
        --> IpClient: DHCP and/or SLAAC + DNS
        --> Wifi NetworkAgent --> ConnectivityService
        --> NetworkMonitor HTTPS probe --> VALIDATED | CAPTIVE | failed

4-way handshake (what to say)

Message 1: AP sends ANonce. Message 2: STA sends SNonce + MIC. Message 3: AP sends GTK + MIC, installs pairwise. Message 4: STA ACK. PTK = KDF(PMK, ANonce, SNonce, MACs). After this, firmware encrypts data frames (CCMP/GCMP). Userspace must not stay in the per-packet crypto path. If the 4-way fails, you are associated-then-disconnected; iw never shows a stable link and there is no DHCP.

L3: DHCP, SLAAC, then scoring + probe

After keys, IpClient (Network stack) runs IPv4 DHCP and/or IPv6 SLAAC + RA, installs addresses via netd, and publishes LinkProperties (DNS, routes, MTU, domains). WifiService registers a NetworkAgent with TRANSPORT_WIFI, INTERNET, and usually NOT_METERED unless the user or portal marked it metered. ConnectivityService scores it against cellular / VPN. NetworkMonitor issues an HTTPS connectivity probe. Success adds NET_CAPABILITY_VALIDATED. Redirect / sign-in page → CAPTIVE_PORTAL. Timeout → IP can still exist; this is the Settings "connected, no internet" case. Same validation idea as cellular; details of fwmark and netd stay on Android Data Call and frameworks.

Tip "Associated" is L2. "Has an IPv4 address" is L3. "VALIDATED" is a userspace probe. Quote all three in a connect bug. PMF is 802.11w; it protects management frames, not the HTTPS probe.
Interview angle Walk scan → assoc → AKM (PSK vs SAE vs EAP) → 4-way → IpClient → agent → probe. Name PNO as the disconnected offload scan. Do not say "WPA3 is just a stronger password in the 4-way."

Roam: 802.11k/v/r, scoring, firmware vs userspace

Roam is a control-plane event that must not look like a new random join if the IP and Network object are to survive. The phone is already associated; it is choosing a better BSSID in the same ESS (same SSID / mobility domain), or failing that and reconnecting.

Analogy

Changing cars on the same train line without buying a new ticket. 802.11k is the posted timetable of nearby cars (neighbor report). 802.11v is the conductor saying "please move to car 4" (BSS Transition Management). 802.11r is a prepaid transfer stamp so you do not re-do the whole ticket office (FT instead of full EAP/4-way). Sticky roam is staying in an emptying car because the threshold to stand up is too high.

AmendmentWhat it gives the STAInterview note
802.11kNeighbor reports, beacon reports — candidate BSSIDs without a full scanReduces scan tax; does not itself move you.
802.11vBSS Transition Management (BTM) request/queryAP can steer; STA may refuse. Look for BTM in supplicant logs.
802.11r (FT)Fast BSS Transition: over-the-air or over-DSReuses PMK-R0/R1; short FT handshake instead of full EAP + 4-way. Needs AP + AKM support.

Who decides to roam

Userspace roam

  • WifiConnectivityManager + score card + connected-scan results.
  • wpa_supplicant own roam (signal threshold, candidate list).
  • Framework may disconnect/reassociate, or ask supplicant to roam.
  • Easier to log; easier to be late; can drop a few packets.

Firmware roam

  • Chip roam engine: RSSI, PER, neighbor table, sometimes 11k/v.
  • Reports via NL80211_CMD_ROAM / vendor events after the fact.
  • Faster, can keep AMPDU sessions; harder to debug from Java.
  • If firmware is sticky or too aggressive, userspace "fixes" fight the chip.

Candidate scoring (framework): current network score versus candidate RSSI, throughput estimate, security, frequency (5/6 GHz vs 2.4), blacklists, and "do not switch for 1 dB." Exact weights live in the Wifi module and move — say "score card + selector, confirm on the drop," not a memorised integer. A sticky-roam bug is a phone that stays on a −85 dBm BSSID while −55 dBm of the same SSID is next to it: roam threshold too conservative, firmware roam disabled, 11k missing so it never saw the neighbor, or a "stick to current" after a recent roam. The opposite bug is ping-pong: roam hysteresis too small.

Dual STA (say this carefully)

Some chipsets expose two concurrent STA interfaces (often wlan0 + wlan1, or a secondary virtual iface): one default internet BSS and one local-only / OEM / specific SSID. This is a HAL concurrency capability, not an AOSP promise on every device. Two STA ifaces mean two L2 links and, if both get agents, two Wi-Fi Networks. Scoring, fwmark and "which wlan did tcpdump miss" get sharper. Do not invent dual-STA as the explanation for SoftAP+STA (that is STA+AP concurrency) or for DBS (dual-band simultaneous on one STA). If you mention dual STA, name it as optional concurrency and offer dumpsys wifi iface list as the proof.

Common pitfall Calling every BSSID change "11r." 11r is an AKM/FT procedure. You can roam with a full 4-way and no 11r. You can also roam and get a new IP (DHCP renew fails, or the new AP is a different L3), which kills TCP even if L2 was fast.
Interview angle Name k/v/r as three different gifts, then firmware vs userspace as two decision makers that can fight. Sticky = threshold / missing candidates, not "bad antenna" as the first sentence.

Uplink hop-by-hop: HTTPS on Wi-Fi

Assume the control plane already succeeded: associated, keys in firmware, address on wlan0, validated default Network. An app fetches an HTTPS URL. This is the data plane. Cellular's equivalent walk is on Android Data Call — same hops until the netdev, then wlan instead of rmnet.

Analogy

The letter is written in the app, stamped by the kernel post office (TCP/IP + fwmark), sorted into the Wi-Fi outbound chute (this Network's table), stuffed into a crate of letters going to the same AP (AMPDU), handed to the building lobby (AP), then the city post (LAN/NAT) and the destination. The 4-way handshake is not written on each letter.

App  OkHttp / HttpURLConnection / Socket / Cronet QUIC
  -> ART + libcore (Java net) / Chromium
  -> bionic connect/sendto/write
  -> inet_sendmsg / tcp_sendmsg  (or udp_sendmsg)
  -> sk_buff
  -> netfilter / nftables
  -> eBPF cgroup/skb egress  (UID allow + stats)
  -> fwmark -> ip rule -> this Network's table
  -> ndo_start_xmit on wlan0 / wlan1
  -> driver DMA to firmware
  -> firmware: encrypt (CCMP/GCMP), rate control, AMPDU + BA
  -> 802.11 data to AP
  -> AP bridges to Ethernet LAN
  -> home/office NAT or L3 router
  -> Internet -> server NIC

wlan vs rmnet (do not merge the pages)

Wi-Fi (wlan*)Cellular (rmnet* / CCMNI)
L2 after the stack802.11 to an AP you associated withVendor mux (QMAP example) to the modem
Beyond the deviceLAN / NAT / maybe a home routerPDCP… → RAN → GTP-U → P-GW/UPF → NAT
IP sourceDHCP / SLAAC on the LANNAS session (PDN / PDU)
Offload flavourFirmware AMPDU, TWT, wowlan, GTK/ND offloadIPA-style + modem UP (see data-call page)
Same on bothSocket, bionic, TCP/IP, eBPF, fwmark, netd, ConnectivityService Network

First connection: connect() SYN on this path, SYN-ACK on downlink, then TLS, then the GET. QUIC is the same fwmark/wlan path with udp_sendmsg. MSS still follows MTU minus headers; a typical Wi-Fi STA MTU is 1500 (sometimes 1500−8 if a vendor inserts a SNAP/LLC quirk — believe ip link). Enterprise Wi-Fi with a smaller inner MTU (VPN-on-SSID) is a common large-POST blackhole that SYNs survive.

MSS = MTU − IP header − TCP header Same arithmetic as cellular: IPv4+TCP without options MSS = MTU − 40; IPv6+TCP MSS = MTU − 60. Options shrink it. AMPDU aggregates already-formed MPDUs; it does not change MSS. If the LAN path is 1422 and ICMP is filtered, large writes die while the validation probe (small) passed.
Interview angle Walk this list without jumping to SAE. Mention SYN versus later tcp_sendmsg, AMPDU as firmware aggregation, and one sentence of contrast to rmnet + GTP-U. Then stop; radio-deep cellular is the other page.

Downlink hop-by-hop: AP to socket

Downlink is not uplink with the arrows flipped. The AP (application processor) is interrupt- and batch-driven. Firmware and the driver decide how often the CPU hears about frames.

Analogy

The AP in the wall is a warehouse. It ships a pallet (AMPDU). Firmware splits the pallet, decrypts, and DMA-writes a stack of boxes. NAPI is the dock worker who turns off the doorbell and unloads a budget of boxes in one go. GRO taping two TCP boxes into one bigger box is allowed. Only then does the office (socket / epoll) get a phone call. Wowlan is a night bell: "wake the building only for this pattern."

Server -> Internet -> NAT/LAN -> AP
  -> 802.11 data (often AMPDU) -> STA firmware
  -> decrypt, BA, reorder, DMA into AP buffers
  -> one IRQ per coalesced batch (not per MPDU when healthy)
  -> wlan driver: napi_gro_receive / gro_cells
  -> NAPI poll in softirq
  -> GRO merges eligible TCP segments
  -> netfilter / eBPF cgroup skb ingress
  -> TCP rcv, sock queue
  -> wait queue / epoll wakes the thread
  -> bionic recv -> ART -> OkHttp read

Sleeping while still "on Wi-Fi"

A connected STA can let the application processor suspend if firmware owns the beacons. That is the point of the offloads:

  • Wowlan — wake-on-WLAN: firmware wakes the AP on a pattern (unicast, magic, 4-way, GTK rekey that it cannot handle, sometimes any unicast).
  • GTK rekey offload — AP rotates the group key; firmware installs it without a full userspace 4-way wake. If this is broken, every rekey resumes the AP and looks like a mysterious wakeup.
  • ARP / ND offload — firmware answers IPv4 ARP and IPv6 Neighbor Solicitation for the STA address so the LAN can still reach you while the AP sleeps. Broken ND offload → inbound IPv6 dies after suspend; IPv4 may still work.
  • TWT (802.11ax) — scheduled wake agreements with the AP so the radio itself sleeps between service periods. See offload-power.
Common pitfall "Every downlink packet hard-IRQs the CPU." Firmware aggregation + NAPI + GRO exist so that is false on a healthy path. Also: wowlan is not Bluetooth LE — do not wander into Bluetooth.
Interview angle Name AMPDU → DMA → NAPI → GRO → eBPF → socket, then wowlan / GTK / ND as the three reasons the AP can sleep while the BSS stays up. Power budget: Power & thermal.

Scoring: Wi-Fi vs cellular, captive, locks, bind, metered

ConnectivityService is the only component apps should treat as "which Network am I on?". WifiService offers a Network; Telephony offers another; VPN may overlay both. Framework overview: Android frameworks. Packet policy (fwmark, netd): data-call page.

Analogy

Two taxi companies (Wi-Fi and cellular) both parked outside. The dispatcher (ConnectivityService) picks the default cab using a scoreboard (capabilities + prefer-policy + validation). A captive portal is a cab that only drives you to the hotel desk. A WifiLock is asking the Wi-Fi driver to keep the engine running. bindProcessToNetwork is a corporate account that may only use one company. Metered is a fare flag, not signal strength.

How the default is chosen

  1. Capabilities — both usually have INTERNET and NOT_RESTRICTED. Cellular is typically metered (no NOT_METERED). Wi-Fi is NOT_METERED unless marked or detected otherwise.
  2. Validation — validated Wi-Fi usually wins default over validated cellular. Unvalidated or lost Wi-Fi yields. Quote current prefer-policy, not a memorised integer from an old NetworkFactory score.
  3. Captive — probe hit a sign-in. Capability CAPTIVE_PORTAL. Often still default so the browser can authenticate; apps should not assume happy internet. After login, re-probe → VALIDATED.
  4. VPN overlay — TUN becomes default; Wi-Fi stays the egress. protect() on tunnel sockets. Same as cellular egress.
  5. Explicit bind — bindProcessToNetwork / Network.bindSocket ignore the default winner for that process or fd.

WifiLock

WifiManager.WifiLock (and multicast lock) asks WifiService to keep the radio from going idle/sleep. Modes have included high-perf vs full high-perf vs scan-only — confirm current names. Locks do not create a Network and do not bypass validation. Leaked locks drain; see power.

bindProcessToNetwork

Forces that process's default fwmark onto one Network (for example "this UID must stay on cellular while Wi-Fi is default"). Network.bindSocket is one fd. Neither changes other apps' default.

Metered Wi-Fi

User or platform can mark a BSS metered (hotspot, tethered, portal). Data Saver and background policy then treat it like cellular. The air is still 802.11; the policy bit changed.

Interview angle "How does Android pick Wi-Fi vs LTE?" — capabilities + prefer-policy + VALIDATED/CAPTIVE + VPN + binds. Then fwmark. Restricted Networks never become Chrome's default. WifiLock is power, not scoring.

SoftAP, tethering, Wi-Fi Direct, NAN

STA is "we join their BSS." SoftAP is "we are the BSS." Mixing those sentences is how people put wpa_supplicant on the hotspot path. Tethering is SoftAP plus forwarding/NAT onto an upstream Network (usually cellular, sometimes another Wi-Fi). Direct and Aware are other HAL ifaces, not a third default internet.

Analogy

STA is being a guest at someone else's party. SoftAP is hosting. Tethering is hosting and running a shuttle to the train (cellular uplink) with a fare box (NAT) — eBPF/hardware is the automated shuttle so you do not drive each passenger. Wi-Fi Direct is a pop-up party with no building owner. NAN/Aware is standing in the square exchanging name tags without a full party.

ModeUserspaceTypical ifaceNotes
STAwpa_supplicantwlan0This page's main path.
SoftAP / hotspothostapd via IHostapdwlan1 or AP ifaceBeacon, assoc, 4-way as AP. Needs STA+AP concurrency or a dedicated radio.
TetheringTethering module + netd + eBPFAP iface + upstreamDHCP/RA to clients, IP forward, NAT44 or prefix, bpf offload. Upstream may be a DUN data call — data-call.
Wi-Fi Direct (P2P)supplicant P2P + IWifiP2pIfacep2p0Group owner looks like a mini-AP. Not the Settings default Network unless an OEM made it one.
NAN / Wi-Fi AwareIWifiNanIfaceNAN ifacePublish/subscribe, ranging-adjacent. Data path is a separate NDP if used; do not call it "scan."

Tethering eBPF programs rewrite and forward between the SoftAP iface and the upstream Network so the AP CPU is not in every client packet — same Tethering-module story as USB/BT-PAN on the data-call page. Hardware (Qualcomm IPA-style examples, other SoC equivalents) may forward wlan-AP ↔ modem without the Linux stack; then tcpdump on rmnet_data0 or wlan1 can lie. STA+AP concurrency is a HAL capability: if the chip cannot do it, starting hotspot tears down STA (or refuses). That is not a ConnectivityService score bug.

Common pitfall "Hotspot is just WifiManager.setWifiEnabled on a different SSID." SoftAP is hostapd + an AP iface + tethering policy. Also: Wi-Fi Direct is not Bluetooth pairing, and Aware is not location — keep Bluetooth off this answer.

Offload and power: PNO, keepalive, TWT, Doze

Wi-Fi power is radio-on time plus application-processor resumes. Offload exists so firmware keeps the BSS (or finds one) while Linux sleeps. Broader Doze / thermal: Power & thermal.

Analogy

The night watch stays in the lobby (firmware) so the office floors (CPU) can go dark. PNO is the watch looking down the street for your favourite shop. Keepalive is mailing a postcard so the LAN NAT does not forget you. TWT is a standing appointment with the AP so the radio is allowed to nap. A full userspace scan every 15 seconds is hiring the entire company to walk the street.

OffloadWho runs itIf it is missing
PNO / NLO / HAL GscanFirmware disconnected or bucketed scanAP stays awake scanning; Doze Wi-Fi drain; slow rejoin after walk-back.
Preferred Network OffloadThe product name for "firmware, not Java, hunts saved SSIDs"Same as a broken PNO path.
Keepalive (TCP/NATT)Firmware or Wifi HAL keepaliveUserspace timers; AP never suspends; or NAT dies and push breaks.
GTK / ARP / ND offloadFirmwareRekey and inbound wakes; IPv6 dies after sleep.
TWT (802.11ax)Firmware + AP agreementRadio stays in a more awake power state between frames; not an Android policy bug.
WowlanFirmware wake patternsAP must stay on to receive; or never wakes for inbound.

Doze and why background scans drain

Doze does not tear down an associated STA just because the screen is off. It restricts app UID networking (eBPF / netpolicy — same as cellular) and the Wifi stack is supposed to move scans to firmware offload and stretch intervals. Drain causes that are actually Wi-Fi:

  • Settings or an app holding a WifiLock / multicast lock.
  • Userspace full scans on a short period (bad OEM scan scheduler, location-with-Wi-Fi, a debug flag).
  • PNO not programmed, so every reconnect hunt is a wide awake scan.
  • Chatty sockets resetting TWT / PS-poll / firmware sleep (same "tail energy" idea as modem DRX).
  • Captive / unvalidated flapping: join, probe fail, retry scan.

Interview formula: energy ≈ (radio awake time) × (awake power) + (AP resumes) × (resume energy). Offload shrinks both. A "Wi-Fi drain in airplane-mode-off, screen-off" bug is almost always scan period, lock, or offload — not AMPDU.

Interview angle Name PNO, keepalive, GTK/ND, TWT, wowlan as the firmware sleep kit. Then say Doze is UID policy plus scan discipline, not "Wi-Fi off." Offer dumpsys wifi + batterystats + wakeup reasons.

Debug playbook

Work top-down for "no icon / won't join," bottom-up for "icon but no packets," and always bisect associated vs has-IP vs validated vs UID-allowed. Cellular-only symptoms belong on Android Data Call.

Analogy

A clinic triage: first "are you in the building?" (assoc), then "do you have a locker?" (IP), then "did the inspector pass you?" (validation), then "is your name on the blocked list?" (UID / DNS). Jumping to firmware logs before iw and dumpsys connectivity is ordering an MRI for a sprained ankle.

Dumps and commands

# Framework / Wifi module
dumpsys wifi
dumpsys connectivity
dumpsys netd
dumpsys dnsresolver
dumpsys netpolicy

# L2 / kernel
ip link show
ip addr show dev wlan0
iw dev wlan0 link
iw dev wlan0 info
iw dev wlan0 scan dump
iw reg get

# Supplicant (interface and socket path vary; confirm on the image)
wpa_cli -i wlan0 status
wpa_cli -i wlan0 list_n
# some builds: wpa_cli -p /data/vendor/wifi/wpa/sockets -i wlan0 status

# Packets and policy
ip rule show
ip route show table all
tcpdump -i wlan0 -n
iptables-save
nft list ruleset

# Logs (tag names move slightly by drop; start here)
logcat -b main -b crash -s WifiService:V WifiClientModeImpl:V ClientModeWificond:V WifiScanningService:V wpa_supplicant:V wificond:V

# Firmware / vendor (path is SoC-specific; do not invent a Qualcomm file name)
# ask for the vendor wifi log / coredump procedure on that chip

"Connected, no internet" bisect

  1. Association — iw dev wlan0 link, dumpsys wifi: BSSID, freq, RSSI, secure? No link: still control plane (scan, auth, 4-way, driver/firmware).
  2. IP — ip addr. No IPv4/IPv6: DHCP/SLAAC / IpClient / AP DHCP pool. You are associated and still have no locker.
  3. Routes and fwmark — default in this Network's table? Rules present? Main table is a red herring when Wi-Fi + cell + VPN coexist.
  4. Validation — dumpsys connectivity: VALIDATED vs CAPTIVE vs none. Probe URL, Private DNS, HTTP intercept. This is the Settings caption.
  5. DNS vs IP — literal vs hostname from the same UID; DnsResolver dump.
  6. UID firewall — Data Saver, standby, VPN lockdown. Shell ping on wlan0 proves little for uid 10123.
  7. On-air vs on-AP — tcpdump on wlan0 empty: never left the stack. UL only: AP/LAN/NAT/MTU. Firmware logs if L2 is retrying or the driver is stuck.
SymptomLikely layerWhat you prove next
Never associatesScan, password/SAE, PMF, driver, reg domainScan dump, supplicant reason, HAL iface up?
Associates, no IPIpClient / DHCP / RAtcpdump bootp/dhcp, RA; AP pool
IP, not VALIDATEDProbe / captive / Private DNSconnectivity dump, probe tcpdump
One app failsUID eBPF / bind / VPNnetpolicy, same host via bindSocket
Sticky to weak BSSIDRoam threshold / firmware roam / 11kCandidate list, BTM, chip roam logs
Hotspot clients fail, phone apps workhostapd / forward / NAT / tether eBPFAP iface, ip_forward, DUN CID
Screen-off Wi-Fi drainScan period, WifiLock, PNO, chatty socketsbatterystats, wakeup, dumpsys wifi
Works on cell, fails on this SSID onlyThis BSS: DHCP, portal, MTU, DNS, 11wBind to TRANSPORT_WIFI and repeat bisect
Tip Firmware logs are precious and late. If iw link is empty, do not start in the PHY. If iw link is happy and validation failed, you have left 802.11.

Quick revision

  • Control plane joins the BSS; data plane is every IP packet on wlan after keys and an address exist.
  • Mixing scan/4-way with tcp_sendmsg in one undifferentiated answer is the usual fail.
  • Cake: WifiManager/ConnectivityManager → WifiService (Mainline, system_server) → wpa_supplicant + wificond + Wifi HAL AIDL → nl80211 → cfg80211 → mac80211 or vendor full-MAC → firmware.
  • hostapd / IHostapd is SoftAP, not STA.
  • Three AIDL surfaces: IWifi (chip), ISupplicant, IHostapd. Do not collapse them.
  • IpClient (Network stack) does DHCP/SLAAC; WifiService owns L2.
  • Scan types: full, directed, connected, PNO/NLO, HAL/firmware Gscan-style offload.
  • WifiConnectivityManager auto-joins; ConnectivityService scores Networks. Different classes.
  • Associated ≠ has IP ≠ VALIDATED.
  • WPA2-PSK: PMK from passphrase, then 4-way (PTK + GTK). WPA3-SAE: SAE then 4-way; PMF mandatory.
  • PMKSA caching skips full SAE/EAP on reconnect; 802.11r is FT, not the same sentence.
  • 4-way is EAPOL control; it is not the HTTPS payload.
  • 802.11k neighbor reports, 802.11v BTM, 802.11r FT — three gifts.
  • Firmware roam vs userspace roam can fight; sticky-roam is threshold or missing candidates first.
  • Dual STA is optional HAL concurrency, not SoftAP+STA and not DBS. Prove it from dumpsys wifi.
  • Uplink: OkHttp → ART → bionic → tcp_sendmsg → skb → nft/eBPF → fwmark table → wlan → firmware AMPDU → AP → LAN/NAT → server.
  • wlan vs rmnet: same Android Network/fwmark story; different L2 and core (no GTP-U on Wi-Fi).
  • Downlink: firmware + NAPI + GRO; not per-MPDU hardirq on a healthy path.
  • Wowlan, GTK rekey offload, ARP/ND offload let the AP sleep while the STA stays on the BSS.
  • Validated Wi-Fi usually beats cellular; captive is a different capability; VPN overlays both.
  • WifiLock keeps the radio awake; it is not a Network and not a score.
  • bindProcessToNetwork vs Network.bindSocket vs default Network — same as cellular.
  • Metered Wi-Fi is a policy bit; Data Saver then applies.
  • Tethering = SoftAP + forward/NAT + Tethering-module eBPF (and optional hardware forward).
  • Wi-Fi Direct is P2P; NAN/Aware is publish/subscribe. Neither is Bluetooth.
  • Wi-Fi calling is IMS (IWLAN/ePDG) over this pipe, not "the AP does voice."
  • PNO / Preferred Network Offload / keepalive / TWT / wowlan are the firmware sleep kit.
  • Background full scans and leaked WifiLocks drain; Doze does not mean Wi-Fi is off.
  • Bisect no-internet: assoc → IP → routes/fwmark → validation → DNS → UID → tcpdump vs firmware.
  • Shell ping ≠ app UID. Always ask which UID you just tested.
  • Mainline Wifi drop can fix selector/auto-join; it cannot fix a full-MAC firmware hang.

Glossary

802.11k
Radio resource measurement: neighbor reports and related, so the STA can roam with fewer full scans.
802.11r
Fast BSS Transition (FT). Reuses PMK-R0/R1 so roam skips full EAP + 4-way.
802.11v
WNM; includes BSS Transition Management so the AP can steer a STA.
802.11w
Protected Management Frames (PMF). Mandatory with WPA3.
4-way handshake
EAPOL exchange that derives PTK from PMK and delivers GTK after association (and after SAE/EAP).
AID
Association Identifier assigned by the AP in Assoc Response.
AKM
Authentication and Key Management suite in the RSN IE (PSK, SAE, 802.1X, FT, …).
AMPDU
Aggregated MAC Protocol Data Unit; firmware/AP packing of several MPDUs with one block ack.
BSS / BSSID
Basic Service Set; BSSID is the AP's MAC for that BSS. SSID is the name; many BSSIDs share one SSID (ESS).
BTM
BSS Transition Management (802.11v) request or query.
cfg80211
Linux kernel configuration API for 802.11. Userspace reaches it through nl80211.
ClientModeManager
Wifi module state machine owner for STA mode (names have shifted around ClientModeImpl).
DBS
Dual-band simultaneous: one chip on two bands at once. Not automatically dual STA.
EAPOL
Frames that carry 802.1X/RSNA key handshake (the 4-way, group rekey).
ESS
Extended Service Set: multiple BSSes sharing an SSID / mobility domain.
FT
Fast Transition; the 802.11r procedure (over-the-air or over-DS).
full-MAC
Driver/firmware own MLME. Typical phone Qualcomm/MediaTek path, as opposed to mac80211 softMAC.
fwmark
32-bit mark selecting a Network's routing table via ip rule. Same contract as on cellular.
Gscan
HAL/firmware bucketed or significant-change scan offload. Confirm the current AIDL name on the build.
GTK
Group Temporal Key; encrypts broadcast/multicast. Rekey can be offloaded to firmware.
hostapd
Userspace AP daemon. SoftAP / hotspot BSS on Android via IHostapd.
IpClient
Network stack component that runs DHCP/SLAAC and builds LinkProperties after L2 is up.
IWifi
AIDL Wifi HAL chip interface (plus chip/iface sub-interfaces). Vendor process.
mac80211
Linux softMAC implementation: MLME in kernel, firmware mostly PHY. Phones often do not use this for the main STA.
MLME
MAC sublayer management entity: scan, auth, assoc, and related 802.11 management.
NAN / Aware
Neighbor Awareness Networking; publish/subscribe and optional NDP. IWifiNanIface.
ND offload
Firmware answers IPv6 Neighbor Solicitation so the AP can sleep.
nl80211
Netlink family userspace uses to talk to cfg80211 (scan, connect, roam events, iface).
NLO
Network list offload; firmware hunts a configured SSID list. Sibling of PNO.
PMF
Protected Management Frames (802.11w). Management frames get integrity (BIP).
PMK
Pairwise Master Key. From PSK, SAE, or EAP. Input to the 4-way.
PMKSA
PMK Security Association cached so the next join can skip full SAE/EAP (PMKID).
PNO
Preferred Network Offload: firmware scans for saved networks while the AP sleeps.
PTK
Pairwise Transient Key from the 4-way; encrypts unicast data.
RSN / RSNA
Robust Security Network (IE) and the association that uses it (WPA2/WPA3 family).
SAE
Simultaneous Authentication of Equals (WPA3-Personal). Dragonfly commit/confirm, then 4-way.
SoftAP
The phone is the AP. hostapd + AP iface; tethering adds NAT/forward.
TWT
Target Wake Time (802.11ax): scheduled radio wake agreements with the AP.
VALIDATED
NetworkCapabilities flag after a successful connectivity probe (and related checks).
WifiConnectivityManager
Wifi-module auto-join and roam-candidate loop. Not ConnectivityService.
wificond
Native daemon that performs nl80211 scan/iface operations for the Wifi module.
WifiLock
App/system lock that keeps Wi-Fi from idling/sleeping. Power, not scoring.
WifiNetworkSelector
Picks a saved/open candidate from scan results using score-card and policy.
WifiService
system_server service from the Wifi Mainline module; policy and mode managers.
wowlan
Wake-on-WLAN: firmware wakes the AP on configured RX patterns.
wpa_supplicant
STA SME daemon: auth, assoc, RSNA, EAP, keys, much roam/FT. ISupplicant AIDL.

Interview questions

Fundamentals

What are the two planes of Android Wi-Fi?

The control plane joins the BSS: scan, associate, RSNA / 4-way, DHCP or SLAAC, a Wifi NetworkAgent, and validation. The data plane is every IP packet after that: socket, kernel, eBPF, fwmark, wlan driver, firmware AMPDU, AP, LAN/NAT, server, and the reverse. Signalling that joined the BSS is not the HTTPS payload.

Why do interviewers fail answers that mix those planes?

Because the bugs and the owners differ. A SAE reject is not an fwmark bug. An eBPF UID drop is not a missing Assoc Response. A strong answer names both planes in one sentence, then stays on the plane the question asked. The map is on Trace a Path Through the Android Stack; this page is the walk. Cellular packets stay on Android Data Call.

Walk the layer cake from app to firmware.

WifiManager / ConnectivityManager → WifiService in system_server (Wifi Mainline module) → wpa_supplicant + wificond + Wifi HAL AIDL → nl80211 → cfg80211 → mac80211 or a vendor full-MAC driver → firmware / PHY. SoftAP uses hostapd instead of the STA supplicant path.

What is WifiService, and where does it run on Android 13–15?

The system Wi-Fi policy and mode-manager service. On 13–15 it comes from the Mainline Wifi module (com.android.wifi) but still runs in system_server. It does not speak nl80211 itself and does not run DHCP (that is IpClient).

What is wificond?

A native daemon used by the Wifi module to trigger scans, collect scan results, and watch iface events over nl80211 (android.net.wifi.nl80211). It is not wpa_supplicant and not the vendor HAL process.

What is wpa_supplicant responsible for?

STA SME: 802.11 authentication/association, RSNA (PSK, SAE, EAP), the 4-way handshake, key install, and a large share of roam / 11k/v/r handling. Android talks to it over AIDL ISupplicant. It is not SoftAP.

What is hostapd on Android?

The userspace AP daemon. SoftAP and hotspot BSS setup go through AIDL IHostapd. Tethering then adds forwarding/NAT via the Tethering module and netd. Do not put hostapd on the STA HTTPS path.

What are nl80211 and cfg80211?

cfg80211 is the kernel 802.11 configuration API. nl80211 is the netlink family userspace uses to call it (scan, connect, roam events, interface create). Drivers register with cfg80211; they are either mac80211 softMAC or vendor full-MAC.

mac80211 versus full-MAC — which do phones use?

mac80211 is softMAC: MLME in the kernel. Phone chips (Qualcomm / MediaTek examples) are typically full-MAC or hybrid: firmware + vendor driver own time-critical MLME. Interview sentence: "cfg80211 is always there; mac80211 is not guaranteed on a phone STA." Driver internals: Linux Kernel & BSP.

What is a BSS, BSSID, SSID and ESS?

SSID is the network name. A BSS is one AP radio cell; BSSID is that AP's MAC. An ESS is several BSSes sharing an SSID / mobility domain — that is what you roam across. "Connected to the SSID" is imprecise; you are associated to one BSSID.

What is the 4-way handshake?

EAPOL after association (and after SAE or EAP). Msg1 ANonce, Msg2 SNonce+MIC, Msg3 GTK+MIC, Msg4 ACK. Derives PTK from PMK and installs keys in firmware. Until it completes, you must not send data frames. It is control plane, not HTTPS.

WPA2-PSK versus WPA3-SAE in one minute?

WPA2-PSK: PMK from the passphrase (PBKDF2), then 4-way. An air capture plus dictionary can attack the PSK. WPA3-SAE: Dragonfly commit/confirm produces a fresh PMK (offline dictionary on the air fails), then 4-way; PMF is mandatory. Do not say "WPA3 is a longer password in the same 4-way."

What is PMF?

Protected Management Frames (802.11w): integrity on deauth/disassoc and other management so an attacker cannot cheaply kick you. Required for WPA3. It is not IPsec and not the validation HTTPS probe.

What is PNO?

Preferred Network Offload: firmware scans for a list of saved networks while the application processor sleeps (typically disconnected, screen off). A wake happens on a match. If PNO is not programmed, userspace full scans drain the battery. Related names: NLO, HAL Gscan-style offload.

Who assigns the IP on Wi-Fi?

The LAN, via DHCPv4 and/or IPv6 RA + SLAAC (sometimes DHCPv6). On Android, IpClient in the Network stack runs that after L2 is up; netd installs addresses. The AP is not the modem; there is no setupDataCall on this path.

What is a Wifi NetworkAgent?

The object WifiService uses to publish a Network plus NetworkCapabilities / link properties / score into ConnectivityService after (or as) L2/L3 come up. Telephony has a sibling agent. Apps should not parse wlan0 themselves. See Android frameworks.

What is Network validation on Wi-Fi?

NetworkMonitor (Network stack) probes a well-known HTTPS connectivity URL. Success → VALIDATED. Redirect/sign-in → CAPTIVE_PORTAL. Failure/timeout → you can still have a DHCP address; Settings shows connected-no-internet. Private DNS can fail validation independently of association.

How does Android usually pick Wi-Fi versus cellular?

ConnectivityService prefer-policy + capabilities + validation. Validated Wi-Fi typically becomes default over cellular. Unvalidated or lost Wi-Fi yields. VPN overlays both. Explicit bindProcessToNetwork / bindSocket ignore the default. Quote policy, not a memorised old integer score.

What is a WifiLock?

A WifiManager lock that asks the stack to keep Wi-Fi from going idle/sleep (and multicast lock for mDNS-style traffic). It does not join a BSS, does not validate, and does not change fwmark. Leaked locks drain. Power: Power & thermal.

What is bindProcessToNetwork on Wi-Fi?

The same API as on cellular: that process's default sockets take the given Network's fwmark/table. Use it to stay on cellular while Wi-Fi is default, or to pin a process to a specific Wi-Fi Network. Network.bindSocket is one fd. Neither is a WifiLock.

Is Wi-Fi calling "just Wi-Fi"?

No. Voice is IMS (SIP/RTP) over an IWLAN / ePDG IPsec session that happens to ride this STA pipe (or over cellular). The 802.11 join is necessary but not sufficient. See IMS & VoLTE. Do not describe it as the AP implementing VoLTE.

Why must you not conflate Wi-Fi with Bluetooth?

Different radio, different controller, different userspace (no wpa_supplicant on classic BT), different power and pairing stories. Direct/Aware are still 802.11. Point Bluetooth questions at Bluetooth and stay on nl80211 here.

Going deeper

Walk control plane from a saved SSID to a validated default Network.

Wifi enabled. Scan (userspace or PNO). WifiNetworkSelector picks a candidate. wpa_supplicant authenticates/associates, runs SAE/EAP if needed, 4-way, installs keys. IpClient DHCP/SLAAC; netd addresses and the Network table. Wifi NetworkAgent registers. NetworkMonitor HTTPS probe. VALIDATED and prefer-policy can make it default versus cellular. Failures drop off at the rung that actually broke.

What is the difference between WifiConnectivityManager and ConnectivityService?

WifiConnectivityManager is inside the Wifi module: when to scan, auto-join, and evaluate roam candidates. ConnectivityService is the system Network dispatcher: agents, scoring between transports, validation, binds, VPN. Auto-join bugs are WCM; "Wi-Fi never becomes default" after a good IP is ConnectivityService.

Name the three Wifi-related AIDL surfaces.

android.hardware.wifi.IWifi (chip, ifaces, offload, RTT, NAN, concurrency). android.hardware.wifi.supplicant.ISupplicant. android.hardware.wifi.hostapd.IHostapd. Binder rules: Binder & AIDL. HIDL exists on older devices; say AIDL for 13–15.

What does the Wifi HAL do that wpa_supplicant does not?

Chip mode, creating STA/AP/P2P/NAN ifaces, firmware scan offload programming, RTT, radio energy info, concurrent-mode capabilities, sometimes keepalive/wowlan knobs. Supplicant speaks 802.11 SME and keys. HAL death and supplicant death are different recoveries.

Full scan versus directed versus PNO versus Gscan.

Full: many channels, Settings/"see all," expensive. Directed: SSID-limited, faster known-network hunt. PNO/NLO: firmware, AP usually asleep, saved-network match. Gscan/HAL offload: firmware bucketed or significant-change results without a userspace dwell thread. Connected scan is off-channel while already associated, for roam.

What is RSNA, and where do you see it?

Robust Security Network Association: the RSN IE on beacons/probe/assoc names AKM and ciphers. wpa_supplicant parses it and runs the matching AKM. "Open network" has no RSNA; captive portals often sit on open or a PSK SSID and still fail VALIDATED until sign-in.

What is PMKSA caching?

The STA and AP remember a PMK/PMKID so the next association can skip full SAE or EAP and go to a 4-way (or FT). It is why a second join to the same BSS is faster. It is not 802.11r by itself; 11r uses a hierarchical PMK-R0/R1.

Walk an HTTPS GET on Wi-Fi after the Network is validated.

OkHttp → ART/libcore → bionic send → tcp_sendmsg → sk_buff → nft/eBPF egress → fwmark → this Network's table → ndo_start_xmit on wlan0 → driver DMA → firmware encrypt + AMPDU → AP → LAN/NAT → server. SYN used the same path first. QUIC is udp_sendmsg.

Contrast the hop after the driver on Wi-Fi versus cellular.

Wi-Fi: 802.11 to the associated AP, then Ethernet/NAT on a LAN. Cellular: vendor netdev (rmnet/CCMNI) → modem user plane → RAN → GTP-U → P-GW/UPF → NAT. Above the netdev, Android is the same (socket, eBPF, fwmark, ConnectivityService). Do not put GTP-U on wlan. Details: Android Data Call.

Why is downlink not "uplink with arrows reversed"?

Uplink is mostly process-context send. Downlink is firmware DMA + coalesced IRQ + NAPI poll in softirq + GRO + then the socket wait queue. Healthy chips do not hardirq once per MPDU. Same NAPI lesson as cellular, different aggregation engine (AMPDU/firmware vs IPA example).

What is TWT and when do you mention it?

Target Wake Time (802.11ax): STA and AP agree service periods so the radio sleeps in between. It is firmware + AP capability, not a Java API you flip in WifiManager on every device. Mention it on power/Doze questions and on "Wi-Fi 6 drain" bugs. Confirm the chip and AP actually negotiated TWT.

What is wowlan versus a WifiLock?

Wowlan: firmware wakes the AP on a packet pattern while Linux is suspended — a sleep feature. WifiLock: userspace forbids that sleep. A leaked lock defeats wowlan. A missing wowlan pattern means inbound push never arrives until the AP resumes for another reason.

What do GTK rekey offload and ND offload actually save?

GTK rekey: the AP rotates the group key on a timer; firmware installs it so userspace does not resume for EAPOL every time. ND/ARP offload: firmware answers neighbor/ARP for the STA address so the LAN still finds you while the AP sleeps. Broken GTK offload looks like periodic unexplained wakes. Broken ND offload looks like "IPv6 dies after screen off, IPv4 is fine."

How do 802.11k, 802.11v and 802.11r differ?

k supplies neighbor/beacon reports (better candidates, fewer full scans). v includes BTM so the AP can ask you to move. r is Fast BSS Transition: PMK-R0/R1 and a short FT handshake instead of full EAP + 4-way. You can roam with none of them (full 4-way). Saying "we roam with 11r" when the AKM is only PSK is a miss.

Firmware roam versus userspace roam — who wins?

Neither always. Firmware is faster and can keep AMPDU; it reports via NL80211_CMD_ROAM / vendor events after the fact. Userspace (WifiConnectivityManager or wpa_supplicant) is easier to log and easier to be late. Sticky or ping-pong often means the two policies fight. Dump both chip roam logs and WCM decisions before blaming the antenna.

What is a sticky-roam bug?

The STA stays on a weak BSSID while a much stronger BSSID of the same ESS is visible. First causes: roam RSSI threshold too conservative, hysteresis after a recent roam, firmware roam disabled, missing 11k so the neighbor was never seen, or a blacklist. It is not "bad antenna" until you have shown the candidate list existed and was ignored.

When is it safe to mention dual STA?

When the HAL advertises two concurrent STA ifaces and dumpsys wifi shows two STA netdevs (often wlan0 + wlan1) associated to different BSSIDs. Then you may have two Wi-Fi Networks and two fwmark tables. Do not use dual STA to explain SoftAP+STA (that is STA+AP concurrency) or DBS (two bands, one STA). It is optional, not an AOSP promise.

How does a captive portal differ from "no internet"?

Captive: the probe was redirected or a sign-in page was detected; capability CAPTIVE_PORTAL; the Network is often still default so the user can authenticate. No internet: probe timed out or failed; iface may still have DHCP; apps should not treat it as happy default. Both show "connected" in casual speech; dumpsys connectivity distinguishes them.

What does marking Wi-Fi metered change?

The air is still 802.11. NOT_METERED is cleared; Data Saver, background restrictions and some app logic then treat the Network like cellular. A user-marked hotspot and an automatically detected tethered SSID are the usual sources. It is not an RSSI or score integer.

SoftAP versus tethering versus STA+AP concurrency?

SoftAP: hostapd beacons a BSS. Tethering: SoftAP plus IP forward, DHCP/RA to clients, NAT or prefix, Tethering-module eBPF, optional hardware forward to the upstream Network (often cellular, sometimes DUN). STA+AP concurrency is a HAL capability that lets you stay a guest and a host at once; if the chip cannot, hotspot tears down STA. Those are three sentences.

What is Wi-Fi Direct versus NAN/Aware?

Direct (P2P): IWifiP2pIface + supplicant P2P; group owner looks like a mini-AP on p2p0. NAN/Aware: IWifiNanIface publish/subscribe (and optional NDP) without a full BSS join. Neither is the Settings default internet Network unless an OEM forced that. Neither is Bluetooth pairing.

Why do background scans drain, and what should have happened instead?

A full userspace scan dwells many channels with the radio and usually the AP awake. Screen-off / Doze should program PNO/NLO/HAL offload and stretch intervals. Drain: leaked WifiLock, location-with-Wi-Fi scan loops, PNO not programmed, captive flap (join, fail probe, scan again), chatty sockets defeating TWT/PS. Energy ≈ radio-awake × awake-power + AP-resumes × resume-energy.

What is Preferred Network Offload in product language?

The product name for "firmware, not Java, hunts saved SSIDs while the AP sleeps." Implementation is PNO/NLO plus HAL scan offload. If a device "won't rejoin after I walk back into the office until I open Settings," suspect PNO not armed, not a missing 4-way.

How does Doze interact with an associated STA?

Doze does not tear down the BSS just because the screen is off. It restricts app UID networking (eBPF / netpolicy — same as cellular) and the Wifi stack should move scans to firmware. The STA can stay associated with wowlan/GTK/ND/TWT holding the fort. "Doze means Wi-Fi off" is wrong. Power: Power & thermal.

Where does eBPF still matter on a Wi-Fi packet?

Same cgroup/skb UID firewall and TrafficStats as cellular, plus Tethering-module programs on SoftAP forward. fwmark still selects the Network table. There is usually no CLAT on Wi-Fi (the LAN is rarely IPv6-only the way a carrier APN is). Do not invent Wifi-specific ELF names; check current AOSP. See data-call eBPF.

What is AMPDU, and does it change MSS?

Aggregated MPDUs on the air with a block ack — firmware/AP packing. It reduces air overhead and helps NAPI batching on downlink. MSS is still MTU minus IP/TCP headers. AMPDU aggregates already-formed MPDUs; it does not enlarge TCP segments. A 1500-byte MTU still yields MSS 1460/1440 (v4/v6, no options).

Advanced

Why can a Mainline Wifi drop fix auto-join but not a full-MAC hang?

Selector, WCM, score card and agent logic live in the Wifi APEX running in system_server. MLME timing, firmware roam and many hangs live in the vendor HAL + driver + firmware, which Mainline does not ship. Interview: name the boundary (AIDL IWifi / ISupplicant) and say which side the symptom is on before promising a module drop.

How should you talk about the Wifi HAL iface model without inventing methods?

Say IWifi → chip → create STA/AP/P2P/NAN iface objects, plus scan-offload / RTT / energy / concurrency capability queries. Exact method names move by AIDL version. Offer to read the current .aidl on the branch. HIDL IWifi is the older sibling. Do not recite a guessed startScan_1_5.

Where does IpClient sit relative to WifiService, and what races exist?

L2 up (assoc + keys) is Wifi; L3 (DHCP/SLAAC, LinkProperties) is Network-stack IpClient. A roam that keeps the L2 Network but fails DHCP renew can blackhole TCP. A new Network object on every BSSID change kills sockets even if the IP is the same. Describe the goal (keep netId + IP across FT) then check the dump — do not assume one implementation forever.

How can firmware roam and WCM fight?

Firmware roams to BSSID A on RSSI; WCM still thinks you are on BSSID B and issues a userspace roam back, or blacklists A. Or firmware is sticky while WCM wants to move. Symptom: ping-pong, or "connected" with a BSSID that Java never selected. Bisect with timestamps: NL80211_CMD_ROAM versus WCM "candidate" lines versus supplicant CTRL-EVENT-CONNECTED.

What must be true for 802.11r to actually be fast?

AKM includes FT; both APs in the mobility domain share PMK-R0/R1 keying (controller or key distribution); STA advertises FT capability; over-the-air or over-DS path works. If any hop is missing, the roam falls back to full EAP or full 4-way and you still "roamed." Enterprise FT failing back to full EAP is the usual "11r is enabled but roam still drops the call" story — voice is IMS, the drop is L2/L3 interruption.

Why can a successful FT still kill TCP?

New BSSID but the new AP is a different L3 (no layer-2 roam domain), DHCP NAK, or Android tears down the Network and issues a new netId/fwmark. QUIC/TCP see a source-address or route change. Fast L2 is necessary, not sufficient. Check ip addr and netId before and after, not only iw link.

How do you explain dual Wi-Fi + cellular without waving hands?

Two (or more) NetworkAgents, two netIds, two tables, two marks. Default scoring picks one for unbound sockets. MMS/IMS/HIPRI or bindSocket use the other. OEM dual-STA adds another Wi-Fi Network. MultipathPreference is policy on an extra path; it is not a second TCP stack. Same sentence as on the data-call page.

When can tcpdump on wlan0 lie?

Hardware tethering/offload: client packets switch in IPA-style hardware and never hit the STA stack. Wrong iface: traffic is on wlan1, p2p0, or tun0. Encrypted 802.11: a monitor-mode capture shows CCMP, not the IP you expected — use the netdev after decrypt, or a monitor iface if the driver exposes one. eBPF drop before egress: tcpdump on the iface is empty even though the app wrote.

How does SoftAP tethering bypass the AP network stack?

When hardware forward is programmed, packets between the AP iface and the upstream CID (often rmnet_dataX) are switched/NATed in the offload engine. Software fallback is Tethering-module eBPF + ip_forward. Debug vendor offload counters plus a capture on the client; do not trust a quiet tcpdump on wlan1 as "no traffic."

What is the interview-safe story for Wi-Fi 6E/7 without turning this into a PHY lecture?

Name the extras that change the Android hops: 6 GHz needs the right regulatory + RSN (no open-in-the-old-sense), TWT is more common, EHT/MLO (Wi-Fi 7 multi-link) can mean more than one link under one STA — treat MLO as "confirm HAL/driver support and whether Android exposes one or two netdevs." Then stop. Rate-control and puncturing are firmware.

How does regulatory domain break "it won't see 5 GHz"?

cfg80211 iw reg get plus the driver's regdb/CRDA-style input (often from the Wifi HAL / country code from telephony or a location provider). A wrong country disables channels; an AP on a DFS channel needs CAC. This is not a password bug. Dump iw phy channel list before rewriting SAE.

PMF required vs optional — how does a mismatch look?

STA requires PMF (WPA3, or an enterprise policy) and the AP advertises capable-but-not-required or none: join fails at assoc/RSN. STA optional, AP required: same. Logs: RSN IE mismatch / "MFP required." Users report "password wrong" because Settings collapses many L2 fails. Read the supplicant reason code.

How does EAP-TLS on enterprise Wi-Fi change the hop list?

After assoc, 802.1X EAPOL carries TLS to a RADIUS server behind the AP (the phone never implements RADIUS). Certificate/identity problems die here — no 4-way, no DHCP. Then 4-way with the derived PMK. WifiService stores the enterprise config; the TLS stack in wpa_supplicant (and the keystore) owns the cert. Do not debug DHCP first.

Why might validation pass while a specific app still fails on this Wi-Fi?

Validation is a system probe UID, not the app UID. The Network is fine; the app is firewalled, bound to a stale Network, using a hard-coded proxy, pinning TLS, or talking to a name that this LAN's DNS rewrites. Bisect with the app's UID and bindSocket. Same trap as cellular.

How do you reason about GSO/checksum offload on wlan?

The netdev may advertise checksum and segmentation features; firmware or the driver completes them. If they are wrongly advertised, you get corruption that tcpdump on the AP (already checksum-complete) will not show. Disable offload only as a bisect, then fix the driver. Do not invent a vendor ioctl name. Kernel: Linux Kernel & BSP.

What does a GTK rekey look like on the two planes?

Control: EAPOL group key handshake (or firmware-offloaded equivalent); new GTK in the chip. Data: multicast/broadcast suddenly decrypts with the new key; unicast PTK is unchanged. If userspace misses the rekey, mDNS/IPv6 RA die and it looks like "Wi-Fi connected but discovery is dead." Unicast HTTPS may still work.

How should IWLAN / Wi-Fi calling be placed on this cake?

This page's STA pipe is up (assoc, IP, usually VALIDATED). Telephony AccessNetworksManager prefers IWLAN; an IWLAN DataService builds IPsec to the ePDG; the session is still a PDN/PDU in the core. Apps keep a telephony Network for IMS, not "Chrome on wlan." It is not "just Wi-Fi browsing." IMS & VoLTE and data-call IWLAN.

How do you talk about Network stack Mainline versus Wifi Mainline without lying about process names?

Wifi module: WifiService, WCM, selector. Network stack: IpClient, NetworkMonitor, DnsResolver, tethering/clat pieces (tethering also has its own module). Both have moved between system_server, a Network stack process, and APEXes. Name the role, then "I would confirm the process with dumpsys wifi, dumpsys connectivity and ps on that build."

Scenario & debugging

Settings shows connected, apps have no internet. Walk the bisect.
  1. Assoc: iw dev wlan0 link, dumpsys wifi.
  2. IP: ip addr.
  3. Routes/rules: ip rule, ip route show table all.
  4. Validation: dumpsys connectivity (VALIDATED vs captive vs none).
  5. DNS vs IP: literal versus hostname; DnsResolver dump.
  6. UID policy: netpolicy, Data Saver, VPN — shell ping is not the app.
  7. tcpdump empty versus UL-only: stack drop versus AP/LAN/MTU.
  8. Firmware only if L2 is retrying or the driver is stuck.

The map-level version is on Trace a Path Through the Android Stack.

Never associates to a known PSK SSID. Where do you look first?

Control plane before DHCP. Scan dump: is the BSSID visible, correct security, right band/reg domain? Supplicant reason: wrong PSK, SAE vs PSK mismatch, PMF, assoc reject. HAL iface up? Driver/firmware error? Do not start with netd. Users often hear "wrong password" for several of these.

Associates, iw link is happy, no IPv4 or IPv6 address.

L3. tcpdump bootp/dhcp and RA on wlan0. If Discover never leaves: IpClient/netd. If Discover leaves and no Offer: AP pool, client isolation, or the AP never saw you (rare if link is really up). IPv6-only LAN with no RA: you will sit with only link-local — validation may still fail.

The Network never becomes VALIDATED on hotel Wi-Fi.

Read the validation attempt: probe URL, HTTP status, redirect. Captive is success-of-a-kind (CAPTIVE_PORTAL) — open a sign-in browser bound to that Network. Timeout: portal blocked HTTPS, Private DNS, or the probe UID is blocked. A working ping to 8.8.8.8 with a failing HTTPS probe is still validation, not a missing 4-way.

IP literals work; hostnames fail, only on this SSID.

DnsResolver / per-netId DNS / Private DNS. Dump resolver config for that netId. Hotel DNS intercept versus Strict Private DNS is a classic. Do not recreate the association first. Cellular working only proves the app, not this LAN's resolver.

Only one app cannot use Wi-Fi; others are fine.

UID eBPF, Data Saver (if the SSID is metered), App Standby, VPN per-app, or that app bound to a stale Network. dumpsys netpolicy and a test bindSocket to the same Network. TrafficStats for that UID stuck at zero is a hint. Do not factory-reset Wi-Fi.

TCP handshake works; a large POST hangs on this SSID only.

MTU/MSS blackhole on the LAN or the hotel NAT; ICMP filtered. Clamp MSS, lower iface MTU, tcpdump segment sizes. Cellular working is the control. Small validation probes fit; TLS records do not.

The phone sticks to a −85 dBm BSSID while −50 dBm of the same SSID is next to it.

Sticky roam. Prove the candidate was visible (connected scan / 11k neighbor). Then roam threshold, firmware roam disabled, recent-roam hysteresis, or WCM blacklist. Collect BTM and chip roam logs. Raising transmit power is not the first fix.

Voice-over-Wi-Fi drops when walking between APs; Chrome barely notices.

IMS is latency-sensitive and may be bound to an IWLAN Network that tears down on L2/L3 change. Chrome retries. Check whether FT actually ran, whether the IP/netId survived, and whether IPsec to the ePDG renegotiated. This is IMS over this pipe, not "Wi-Fi is down."

Screen-off Wi-Fi drain after a Wifi module drop; throughput is fine.

Suspect scan period, PNO not armed, leaked WifiLock, captive flap, or chatty sockets defeating TWT/PS — not AMPDU. dumpsys wifi, batterystats wakeup reasons, dumpsys connectivity validation flaps. Compare to last good drop. Firmware TWT/wowlan only after userspace scan tax is gone. Power.

Hotspot clients get an IP but cannot reach the internet; the phone's own apps work.

Forwarding / NAT / tether eBPF / hardware offload / DUN second CID — not STA join. ip_forward, nft NAT counters, tethering dumps, capture on the AP iface versus the upstream (rmnet or another wlan). Carrier may require DUN. Client IPv6-only while you only NATed IPv4 is a common miss. Data-call tethering.

Starting hotspot tears down STA Wi-Fi.

STA+AP concurrency not available on this chip/firmware/HAL combination. Confirm concurrent iface capabilities from the HAL dump / dumpsys wifi. This is not ConnectivityService prefer-policy. Workaround is firmware/HAL or "hotspot only in airplane+cell," not a new score integer.

Works on cellular; fails only on this SSID.

Bind a test to TRANSPORT_WIFI and repeat the bisect: DHCP, portal, MTU, DNS, PMF, enterprise cert, LAN firewall. Cellular succeeding only proves the app and TLS stack, not this BSS.

Works on this SSID from a laptop; the phone will not associate.

Phone-specific: PMF/WPA3 transition mode, PMF required, 6 GHz RSN, wrong country/reg, hidden SSID + directed scan, or a saved network with stale security (PSK saved, AP moved to SAE). Compare iw scan IEs to the saved config. Laptop open-driver softMAC is not a full-MAC phone.

IPv4 apps work after suspend; IPv6 inbound dies.

ND offload missing or broken; firmware is not answering Neighbor Solicitation. IPv4 ARP offload may still work. Confirm with a neighbor solicit from another LAN host while the phone is suspended, plus vendor wowlan/ND flags. Do not disable IPv6 as the first "fix."

Periodic wakes every few minutes on an idle associated STA.

GTK rekey without offload, unoffloaded keepalive, scannable WCM period, or a chatty app. Align wake timestamps with EAPOL group key, DHCP renew, and PNO. dumpsys wifi + batterystats. This is control-plane or offload, not HTTPS.

tcpdump on wlan0 is empty while the app is sending.

Packets never reached that netdev: wrong fwmark/table (sent to rmnet or tun0), eBPF drop, dual-STA traffic on wlan1, or the app is not actually writing. Confirm ss 5-tuple, marks, and tcpdump on the other ifaces. Hardware tether is the other lie.

tcpdump shows uplink on wlan0 but no downlink.

Left the AP stack. Check AP/LAN/NAT, client isolation (guest SSID), AP ACL, or MTU (large only). If 802.11 retries climb in firmware logs, it is air/AP, not netd. If firmware never gets the frame, driver/DMA between tcpdump and the chip.

Always-on VPN kills Wi-Fi browsing; the VPN itself never comes up.

Protect mark missing: tunnel sockets enter tun0 and loop. Or lockdown dropped the underlying Wi-Fi Network before the tunnel came up. Dump fwmark on the VPN PID and ip rule. IMS on IWLAN may also die if lockdown is too broad.

Private DNS is a specified hostname; this SSID is unhappy, cellular is fine.

DoT (port 853) or bootstrap DNS is filtered on the LAN. Cellular can reach the DoT server. Try Automatic, or a literal probe. This is resolver/validation, not SAE. Some hotels break DoT only.

An app works only after bindProcessToNetwork to cellular while Wi-Fi is default.

Default is this Wi-Fi (maybe captive or a broken LAN) or a VPN the app cannot use. Binding proves cellular is healthy. Fix scoring/validation/VPN or teach the app to request the right Network. Do not "fix" it by forgetting the SSID.

After a driver change, scan results are empty in Settings but iw scan sees APs.

Kernel sees beacons; the userspace path from wificond / HAL callbacks into WifiService is broken (iface permission, netlink group, HAL scan offload vs wificond disagreement). Dump wificond and WifiScanningService. This is not a passphrase bug and not ConnectivityService.

How would you structure "trace HTTPS from OkHttp to the server on Wi-Fi" in 90 seconds?

One sentence control plane (already associated, IP, VALIDATED). Uplink: OkHttp → ART → bionic → tcp_sendmsg → skb → nft/eBPF → fwmark table → wlan → firmware AMPDU → AP → LAN/NAT → server. Downlink: reverse but name firmware DMA, NAPI, GRO, epoll. One sentence contrast to rmnet + GTP-U. Offer dumps per layer. Point IMS calling at IMS and Bluetooth at Bluetooth.