fix(wireless): drop default MAC binding on connect - #608
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: caixr23 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRemoves automatic persistence of a wireless device’s permanent MAC address during connection creation and activation, preventing interference with randomized-MAC auto-reconnect while leaving explicit user-selected bindings under WirelessSection control. Sequence diagram for wireless connection without default MAC bindingsequenceDiagram
participant User
participant WirelessDeviceManagerRealize
participant NetWirelessConnect
participant WirelessSection
participant ConnectionProfile
User->>WirelessDeviceManagerRealize: connectNetwork(accessPoint)
WirelessDeviceManagerRealize->>ConnectionProfile: setSsid(ssid)
WirelessDeviceManagerRealize->>ConnectionProfile: setInitialized(true)
User->>NetWirelessConnect: activateConnection()
NetWirelessConnect->>ConnectionProfile: setAutoconnect(false)
User->>WirelessSection: Select NIC binding or Not Bind
WirelessSection->>ConnectionProfile: setMacAddress(selectedMacOrEmpty)
ConnectionProfile-->>User: Profile keeps explicit binding or cleared MAC
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
1. Remove code that wrote the device permanent/real hardware address into the Wireless setting when creating or activating a connection (WirelessDeviceManagerRealize::connectNetwork, NetWirelessConnect::activateConnection) 2. Keep user-selected device binding in WirelessSection 3. A pinned MAC defeats random-MAC mode and blocks auto-connect after reboot, leaving wifi disconnected Log: Wireless auto-reconnects after reboot with random MAC enabled Influence: 1. Connect to WiFi, reboot, verify it reconnects automatically 2. Bind a wireless connection to a specific NIC in control center, verify profile keeps that mac-address 3. Choose "Not Bind", verify mac-address cleared from profile fix(wireless): 默认不再将连接绑定到网卡MAC地址 1. 移除创建/激活连接时将设备永久/真实硬件地址写入无线配置的代码 (WirelessDeviceManagerRealize::connectNetwork、 NetWirelessConnect::activateConnection) 2. 保留控制中心 WirelessSection 中用户手动选择的网卡绑定 3. 固定 MAC 会破坏随机 MAC 功能,且导致重启后无线无法自动回连 Log: 开启随机 MAC 后,重启系统可自动重连无线网络 Influence: 1. 连接 WiFi 后重启系统,验证能自动重连 2. 控制中心绑定指定网卡后,验证配置保留该 mac-address 3. 选择"不绑定",验证配置中 mac-address 已清空 PMS: BUG-374945
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 语法正确,逻辑清晰。两个文件的代码删除均不影响控制流完整性:1.netwirelessconnect.cpp 中 activateConnection() 移除的 MAC 绑定代码块为自包含逻辑,删除后从 findConnectionByUuid 到 setAutoconnect 的流程衔接正常;2.devicemanagerrealize.cpp 中 connectNetwork() 移除 MAC 设置行后,setSsid 和 setInitialized 调用仍保持正确顺序。 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 代码结构清晰,变更聚焦。本次 PR 仅移除了两处不必要的 MAC 地址绑定代码,变更范围明确。版权年份从 2022 更新为 2026 符合规范。无重复代码、无残留调试信息。 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 性能良好,资源使用合理。移除了 m_device->realHwAdr() 和 m_device->permanentHardwareAddress() 的调用以及 MAC 地址字符串处理操作,减少了不必要的设备查询和字符串操作。 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: 存在0个安全漏洞。本次变更移除了 MAC 地址绑定,反而有助于隐私保护,支持 MAC 随机化功能。无硬编码密钥、无注入风险、无敏感信息泄露。 💡 改进建议代码示例// 本次变更无需修复代码示例
// 移除 MAC 绑定后的 activateConnection() 代码流程:
// conn = findConnectionByUuid(m_connectionSettings->uuid());
// // MAC 绑定代码已移除,直接进入后续逻辑
// if (ConfigSetting::instance()->enableAccountNetwork())
// m_connectionSettings->setAutoconnect(false);
// 移除 MAC 绑定后的 connectNetwork() 代码流程:
// wirelessSetting->setSsid(accessPoint->ssid().toUtf8());
// // MAC 绑定代码已移除,保留 setInitialized
// wirelessSetting->setInitialized(true);本报告由 AI 代码审查工具自动生成 |
Log: Wireless auto-reconnects after reboot with random MAC enabled
Influence:
fix(wireless): 默认不再将连接绑定到网卡MAC地址
Log: 开启随机 MAC 后,重启系统可自动重连无线网络
Influence:
PMS: BUG-374945
Summary by Sourcery
Allow wireless connections to use their configured MAC-binding choice instead of forcing a default device binding.
Bug Fixes:
Enhancements: