Skip to content

bridge: reset primary on adding device to empty bridge#50

Open
wryun wants to merge 1 commit intoopenwrt:masterfrom
wryun:reset-primary-on-adding-to-empty-bridge
Open

bridge: reset primary on adding device to empty bridge#50
wryun wants to merge 1 commit intoopenwrt:masterfrom
wryun:reset-primary-on-adding-to-empty-bridge

Conversation

@wryun
Copy link

@wryun wryun commented Jun 6, 2025

This means that when only wireless devices are on a bridge, set the MAC to something predictable.

EDIT: I raised this too quickly. I've realised now that the MAC address is set by br_stp_recalculate_bridge_id (kernel) to whatever the lowest MAC of a device that's added to the bridge, which gives a deterministic mac address at the end regardless of bring-up order, whereas this PR would have non-determinism depending on when the device was added. It's still useful for use because we rely on a deterministic mac address during bring-up in order for wpa_supplicant to set its mac address to the bridge mac address (as this makes assoclist/getHostHints better).

This seems to work as I would expect. However, I'm not familiar with netifd internals so I've probably missed something, and there may be a connected issue where if you remove devices so that the bridge is empty then add it will consider the MAC address already set and will refuse to reset_primary (see bridge_reset_primary). I haven't tried to change this, as it looks like it would require additional state.

This means that when only wireless devices are on a bridge,
the MAC is set to something predictable (otherwise a random
MAC is used which differs on each bring-up).
@wryun wryun force-pushed the reset-primary-on-adding-to-empty-bridge branch from 2304841 to 45fbb02 Compare June 12, 2025 04:23
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.

1 participant