Skip to content

luci-mod-network: fix multicast_router port option mapping - #9124

Open
qjebbs wants to merge 1 commit into
openwrt:masterfrom
qjebbs:fix-multicast-router-option
Open

qjebbs wants to merge 1 commit into
openwrt:masterfrom
qjebbs:fix-multicast-router-option

Conversation

@qjebbs

@qjebbs qjebbs commented Oct 10, 2026

Copy link
Copy Markdown

Fixes the two issues reported in #9087.

1. "Never" did not disable the port

The bridge port Multicast routing dropdown mapped "Never" to the empty
value, so selecting it removed the UCI option instead of writing 0.
netifd only writes brport/multicast_router when the option is present,
so the port kept the kernel init default (MDB_RTR_TYPE_TEMP_QUERY == 1)
and was still treated as a multicast router port on general IGMP queries.

2. An existing option multicast_router '0' was silently dropped

0 was not part of the choice list, so the widget rendered with nothing
selected and saving the page removed the option, reverting the port to 1.

Changes

  • add an explicit '' -> "Auto (Learn)" entry, which removes the option so
    that the kernel default (1, learn) applies
  • list the real values 0, 1 and 2, so that "Never" really writes 0
    and existing 0/1/2 values are always representable and preserved

The explicit 1 entry is intentionally kept next to the automatic one: an
absent option is left untouched by netifd, while option multicast_router '1' is re-applied on every reload. This mirrors the existing autoneg
option (automatic (enabled) + Enable).

Tested manually on OpenWrt x86/64: selecting "Never" now writes
option multicast_router '0' (and brport/multicast_router reads 0),
while a previously set 0 survives a save.

@openwrt openwrt Bot added the not following guidelines Pull request does not follow formatting guidelines label Oct 10, 2026
The bridge port "Multicast routing" dropdown mapped "Never" to the
empty value, so choosing it removed the option instead of writing 0.
As netifd only writes brport/multicast_router when the option is
present, the port then kept the kernel init default
(MDB_RTR_TYPE_TEMP_QUERY == 1) and was still learned as a multicast
router port.

Additionally, 0 was not part of the choice list, so an existing
`option multicast_router '0'` rendered with nothing selected and was
silently dropped when saving the page, reverting the port to 1.

Add an explicit `''` -> "Auto (Learn)" entry which drops the option so
that the kernel default (1, learn) applies, and list the real values 0,
1 and 2 so that "Never" really writes 0 and existing 0/1/2 values are
preserved. Keep the explicit 1 entry as it is not the same state as a
missing option: netifd re-applies it on every reload.

Link: openwrt#9087
Signed-off-by: Jebbs Chiu <qjebbs@gmail.com>
@qjebbs
qjebbs force-pushed the fix-multicast-router-option branch from a671ed0 to 21baa10 Compare October 10, 2026 09:55
@openwrt openwrt Bot removed the not following guidelines Pull request does not follow formatting guidelines label Oct 10, 2026

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed 1 new commits; no new issues found.


Generated by Claude Code

This branch has not been deployed

No deployments
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