问题现象
客户使用A133设备连接WIFI后,使用一段儿时间后就掉网了
问题日志
09-09 15:50:29.125689 4119 4119 I wpa_supplicant: wlan0: Trying to associate with e4:4e:12:9f:f7:2f (SSID='CMCC-ubNb' freq=2462 MHz)
09-09 15:50:29.480196 4119 4119 I wpa_supplicant: wlan0: Associated with e4:4e:12:9f:f7:2f
09-09 15:50:29.480788 4119 4119 I wpa_supplicant: wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
09-09 15:50:29.483213 4119 4119 I wpa_supplicant: wlan0: CTRL-EVENT-REGDOM-CHANGE init=COUNTRY_IE type=COUNTRY alpha2=CN
09-09 15:50:29.487425 4119 4119 I wpa_supplicant: wlan0: WPA: RX message 1 of 4-Way Handshake from e4:4e:12:9f:f7:2f (ver=2)
09-09 15:50:29.487930 4119 4119 I wpa_supplicant: wlan0: WPA: Sending EAPOL-Key 2/4
09-09 15:50:29.492699 4119 4119 I wpa_supplicant: wlan0: WPA: RX message 3 of 4-Way Handshake from e4:4e:12:9f:f7:2f (ver=2)
09-09 15:50:29.492853 4119 4119 I wpa_supplicant: wlan0: WPA: Sending EAPOL-Key 4/4
09-09 15:50:29.498733 4119 4119 I wpa_supplicant: wlan0: WPA: Key negotiation completed with e4:4e:12:9f:f7:2f [PTK=CCMP GTK=CCMP]
09-09 15:50:29.498937 4119 4119 I wpa_supplicant: wlan0: CTRL-EVENT-CONNECTED - Connection to e4:4e:12:9f:f7:2f completed [id=0 id_str=%7B%22configKey%22%3A%22%5C%22CMCC-ubNb%5C%22WPA_PSK%22%2C%22creatorUid%22%3A%221000%22%7D]
09-09 15:50:29.507370 2241 2342 D ConnectivityService: registerNetworkAgent NetworkAgentInfo{ ni{[type: WIFI[], state: CONNECTING/CONNECTING, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]} network{101} nethandle{437197393933} lp nc{[ Transports: WIFI Capabilities: NOT_METERED&INTERNET&NOT_RESTRICTED&NOT_VPN&NOT_ROAMING&FOREGROUND&NOT_CONGESTED&NOT_SUSPENDED LinkUpBandwidth>=1048576Kbps LinkDnBandwidth>=1048576Kbps Specifier: <WifiNetworkAgentSpecifier [WifiConfiguration=, SSID="CMCC-ubNb", BSSID=e4:4e:12:9f:f7:2f, mOriginalRequestorUid=-1, mOriginalRequestorPackageName=]> SSID: "CMCC-ubNb"]} Score{20} everValidated{false} lastValidated{false} created{false} lingering{false} explicitlySelected{false} acceptUnvalidated{false} everCaptivePortalDetected{false} lastCaptivePortalDetected{false} captivePortalValidationPending{false} partialConnectivity{false} acceptPartialConnectivity{false} clat{mBaseIface: null, mIface: null, mState: IDLE} }
09-09 15:50:29.510974 2241 2345 D ConnectivityService: NetworkAgentInfo [WIFI () - 101] EVENT_NETWORK_INFO_CHANGED, going from null to CONNECTING
09-09 15:50:29.548902 2241 2345 D ConnectivityService: NetworkAgentInfo [WIFI () - 101] EVENT_NETWORK_INFO_CHANGED, going from CONNECTING to CONNECTING
-09 15:50:29.549941 2241 2342 E WifiVendorHal: configureNeighborDiscoveryOffload(l.2139) failed {.code = ERROR_NOT_AVAILABLE, .description = }
09-09 15:50:29.568539 2241 4267 D ApfFilter: (wlan0): begin monitoring
09-09 15:50:29.573491 1938 2187 I netd : interfaceSetIPv6PrivacyExtensions("wlan0", "true") <0.36ms>
09-09 15:50:29.574759 1938 2187 I netd : setIPv6AddrGenMode("wlan0", 0) <0.24ms>
09-09 15:50:29.575928 1938 2187 I netd : interfaceSetEnableIPv6("wlan0", "true") <0.35ms>
09-09 15:50:29.583872 2241 2345 D ConnectivityService: Adding iface wlan0 to network 101
09-09 15:50:29.584289 1938 2187 E Netd : no such netId 101
09-09 15:50:29.584782 1938 2187 I netd : networkAddInterface(101, "wlan0") -> ServiceSpecificException(64, "Machine is not on the network") <0.09ms>
09-09 15:50:29.585425 2241 2345 E ConnectivityService: Exception adding interface: java.lang.IllegalStateException: android.os.ServiceSpecificException: Machine is not on the network (code 64)
09-09 15:50:29.585950 1938 2187 E Netd : no such netId 101
09-09 15:50:29.586119 1938 2187 I netd : networkAddRoute(101, "wlan0", "fe80::/64", "") -> ServiceSpecificException(64, "Machine is not on the network") <0.06ms>
09-09 15:50:29.613290 2241 4268 D DhcpClient: Receive thread started
09-09 15:50:29.624126 2241 4124 D DhcpClient: Broadcasting DHCPDISCOVER
09-09 15:50:30.604602 2241 4267 D ApfFilter: (wlan0): Adding RA fe80::1 -> ff02::1 1800s 2409:8a6c:7515:2580::/64 221133s/134733s DNS 4294967295s fe80::1
09-09 15:50:30.647232 1938 2187 E Netd : no such netId 101
09-09 15:50:30.647766 1938 2187 I netd : networkAddRoute(101, "wlan0", "2409:8a6c:7515:2580::/64", "") -> ServiceSpecificException(64, "Machine is not on the network") <0.20ms>
09-09 15:50:30.650956 1938 2187 E Netd : no such netId 101
09-09 15:50:30.652237 1938 2187 I netd : networkAddRoute(101, "wlan0", "::/0", "fe80::1") -> ServiceSpecificException(64, "Machine is not on the network") <0.89ms>
09-09 15:50:30.703847 2241 2345 D ConnectivityService: Setting DNS servers for network 101 to [/fe80::1]
09-09 15:50:30.704810 2241 2345 D DnsManager: setDnsConfigurationForNetwork(101, [fe80::1], [], 1800, 25, 8, 64, 0, 0, , [])
09-09 15:50:30.705505 1938 2187 I netd : DnsResolverService::setResolverConfiguration(101, [fe80::1], [], 1800, 25, 8, 64, 0, 0, [], []) -> (-64) (0.07ms)
09-09 15:50:30.705734 1938 2187 I netd : setResolverConfiguration() -> ServiceSpecificException(64, "Machine is not on the network") <0.29ms>
09-09 15:50:30.706366 2241 2345 E DnsManager: Error setting DNS configuration: android.os.ServiceSpecificException: Machine is not on the network (code 64)
09-09 15:50:30.754701 2241 2345 D ConnectivityService: NetworkAgentInfo [WIFI () - 101] EVENT_NETWORK_INFO_CHANGED, going from CONNECTING to CONNECTED
09-09 15:50:30.756085 1938 2187 I netd : networkCreatePhysical(101, 0) <0.42ms>
09-09 15:50:30.757929 1938 2187 I netd : createNetworkCache(101) <0.21ms>
09-09 15:50:30.759632 2241 2345 W DnsManager: updatePrivateDns(101, PrivateDnsConfig{true:/[]})
09-09 15:50:30.759837 2241 2345 D ConnectivityService: Setting DNS servers for network 101 to [/fe80::1]
09-09 15:50:30.760358 2241 2345 D DnsManager: setDnsConfigurationForNetwork(101, [fe80::1], [], 1800, 25, 8, 64, 0, 0, , [fe80::1])
09-09 15:50:30.761703 1938 2187 I netd : DnsResolverService::setResolverConfiguration(101, [fe80::1], [], 1800, 25, 8, 64, 0, 0, [fe80::1], []) -> (0) (0.8ms)
09-09 15:50:30.761972 1938 2187 I netd : setResolverConfiguration() <1.07ms>
09-09 15:50:30.762673 2241 2345 D ConnectivityService: Adding iface wlan0 to network 101
09-09 15:50:30.772215 1938 2187 I netd : networkAddInterface(101, "wlan0") <8.76ms>
09-09 15:50:30.774936 1938 2187 I netd : networkAddRoute(101, "wlan0", "fe80::/64", "") <0.69ms>
09-09 15:50:30.777275 1938 2178 I netd : networkAddRoute(101, "wlan0", "2409:8a6c:7515:2580::/64", "") <1.01ms>
09-09 15:50:30.778430 1938 2178 E Netd : Error adding route ::/0 -> fe80::1 wlan0 to table 1013: File exists
09-09 15:50:30.778612 1938 2178 I netd : networkAddRoute(101, "wlan0", "::/0", "fe80::1") <0.47ms>
09-09 15:50:30.779028 2241 2345 D ConnectivityService: Setting DNS servers for network 101 to [/fe80::1]
09-09 15:50:30.779695 2241 2345 D DnsManager: setDnsConfigurationForNetwork(101, [fe80::1], [], 1800, 25, 8, 64, 0, 0, , [fe80::1])
日志分析
┌──────────────────────────────────────────┐
│ Wi-Fi 连接流程日志 │
└──────────────────────────────────────────┘
[1] Wi-Fi 扫描/关联阶段
wlan0: Trying to associate with AP (SSID=CMCC-ubNb)
wlan0: Associated with e4:4e:12:9f:f7:2f
└─> 成功关联到 AP
[2] WPA 4-Way Handshake
RX msg1 → 发送 msg2
RX msg3 → 发送 msg4
Key negotiation completed (PTK=CCMP, GTK=CCMP)
└─> WPA 握手完成,加密建立
[3] ConnectivityService 建立网络对象
registerNetworkAgent (network{101}, state=CONNECTING)
└─> Android 创建 netId=101 作为 Wi-Fi 网络
[4] Netd 配置 IPv6
interfaceSetEnableIPv6("wlan0", true)
networkAddInterface(101, "wlan0") → ❌ ServiceSpecificException(64)
└─> 错误:Machine is not on the network
networkAddRoute / setDnsConfiguration 也失败 (code 64)
[5] DHCP/RA 下发
DhcpClient: Broadcasting DHCPDISCOVER
APfFilter: RA fe80::1 → 分配 IPv6 前缀 & DNS
但此时仍有 netd 报错 no such netId 101
[6] 网络状态切换
ConnectivityService: from CONNECTING → CONNECTED
netd: networkCreatePhysical(101) 成功
createNetworkCache(101) 成功
setResolverConfiguration(101, [fe80::1]) 成功
networkAddInterface/Route/DNS → ✅ 正常完成
└─> Wi-Fi 网络最终建立成功
────────────────────────────────────────────
⚠️ 问题点:
- 在 **[4] IPv6 配置阶段**,netd 报 `Machine is not on the network (code 64)`。
- 说明 **在 DHCP/RA 尚未下发地址之前**,ConnectivityService 就尝试让 netd 配置路由/DNS → 失败。
- 后续 DHCP 成功 → netd 重新配置 → 网络正常。
────────────────────────────────────────────