Skip to content

feat(ports): mark the management port in the chassis - #550

Merged
gnacho merged 1 commit into
mainfrom
feat/543-mgmt-port-badge
Oct 20, 2026
Merged

gnacho merged 1 commit into
mainfrom
feat/543-mgmt-port-badge

Conversation

@gnacho

@gnacho gnacho commented Oct 20, 2026

Copy link
Copy Markdown
Owner

Problem

The chassis view treats every port the same, but the port the panel itself is reached through is the risky one to touch with mirror, rate limit or STP changes. The mirror probe already deduces it (default gateway -> ARP -> bridge FDB, as management_port), but fetching the whole mirror probe just for a badge is too heavy: it runs a tc filter show per port.

Approach

A lightweight GET /api/management-port runs only the heuristic (two /proc reads plus one brctl showmacs). The chassis fetches it lazily after the first paint, so detection latency on dense switches never delays the initial render. The matching tile gets a lock badge in the corner opposite the PoE one, the tooltip names the port and the chassis legend gains an entry. When the port cannot be deduced, or the probe is missing, there is no badge and the chassis renders exactly as before. Demo mode stubs an empty port.

Verification

End-to-end on a live 52-port Linksys LGS352C (OpenWrt, mips): the endpoint returns lan27, the real uplink. A headless browser session confirms the lock badge lands on the LAN 27 tile, the legend shows "Puerto de gestión", and there are zero page errors. go vet, the full Go test suite and the TypeScript + Vite build are green.

The chassis view treated every port the same, but the port the panel
itself is reached through is the risky one to touch with mirror, rate
limit or STP changes. The mirror probe already deduced it
(gateway -> ARP -> bridge FDB) but fetching the whole mirror probe for a
badge is too heavy (a tc filter show per port).

Add a lightweight GET /api/management-port that runs only the heuristic
(two /proc reads plus one brctl showmacs) and load it lazily from the
chassis after the first paint: the matching tile gets a lock badge in
the corner opposite the PoE one, the tooltip names it and the legend
gains an entry. Undetected or missing probe: no badge, the chassis
renders exactly as before. Demo mode stubs an empty port.

Verified end-to-end on a 52-port Linksys LGS352C: the endpoint returns
lan27 (the real uplink), the badge lands on the LAN 27 tile and the
legend shows, with zero page errors.

Closes #543
@gnacho
gnacho merged commit 2c291d4 into main Oct 20, 2026
2 checks passed
@gnacho
gnacho deleted the feat/543-mgmt-port-badge branch October 20, 2026 09:24
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