Skip to content

fix(wireless): drop default MAC binding on connect - #608

Open
caixr23 wants to merge 1 commit into
linuxdeepin:masterfrom
caixr23:master
Open

fix(wireless): drop default MAC binding on connect#608
caixr23 wants to merge 1 commit into
linuxdeepin:masterfrom
caixr23:master

Conversation

@caixr23

@caixr23 caixr23 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor
  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

Summary by Sourcery

Remove the default wireless device MAC binding so connections can use random MAC addresses and reconnect automatically while retaining explicit user bindings.

Bug Fixes:

  • Stop automatically binding wireless connections to the device’s permanent MAC address, preserving random-MAC operation and allowing Wi-Fi to reconnect after reboot.

Enhancements:

  • Preserve MAC bindings only when explicitly selected by the user in the wireless connection settings, including clearing the binding when “Not Bind” is chosen.

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-ci-robot

Copy link
Copy Markdown

[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.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai

sourcery-ai Bot commented Aug 26, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Removes 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 binding

sequenceDiagram
    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
Loading

File-Level Changes

Change Details Files
Stop implicitly binding wireless profiles to the connected device’s permanent hardware MAC address.
  • Removed default MAC assignment during connection activation.
  • Removed permanent hardware MAC assignment when creating a connection from an access point.
  • Continued initializing the wireless setting without overriding its user-selected binding.
net-view/operation/private/netwirelessconnect.cpp
src/impl/networkmanager/devicemanagerrealize.cpp
Preserve explicit device-binding behavior managed by the control center.
  • Allow user-selected MAC bindings in WirelessSection to remain unchanged.
  • Allow the “Not Bind” choice to clear the profile MAC address instead of being replaced during connection.
net-view/operation/private/netwirelessconnect.cpp
src/impl/networkmanager/devicemanagerrealize.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants