Skip to content

Trust device-reported uplink speed over upstream port table#209

Open
tvancott42 wants to merge 5 commits intomainfrom
bugfix/trust-ap-uplink-speed
Open

Trust device-reported uplink speed over upstream port table#209
tvancott42 wants to merge 5 commits intomainfrom
bugfix/trust-ap-uplink-speed

Conversation

@tvancott42
Copy link
Collaborator

Summary

  • When tracing network paths for wired UniFi devices (APs, modems, etc.), now prefers the device's own reported uplink speed over the upstream switch's port table
  • Fixes incorrect speed reporting when an unmanaged switch sits between a UniFi device and the upstream UniFi switch/gateway
  • Adds debug logging to show when device-reported speed differs from upstream port table

Background

When a UniFi device connects through an unmanaged PoE switch, the upstream UniFi port may report a different (usually higher) speed than the device's actual link. For example, an AP with 1 GbE connected to an unmanaged switch, which connects to a gateway via 10 GbE SFP+ - the gateway port shows 10 GbE but the AP correctly reports 1 GbE.

Test plan

  • Build succeeds with 0 warnings
  • All 4,840 tests pass
  • Verified no regression on wired APs (speeds match)
  • Verified no regression on mesh APs (uses wireless path, unaffected)
  • Debug logging shows speed values for troubleshooting

Fixes #189

When a UniFi device (AP, modem, etc.) has a wired uplink through an
unmanaged switch, the upstream UniFi switch port may report a different
speed than what the device actually negotiates. For example, an AP with
1 GbE connected to an unmanaged PoE switch, which is connected to a
gateway via 10 GbE SFP+ - the gateway port shows 10 GbE but the AP
reports 1 GbE.

Now prefer the device's own reported uplink speed (from Uplink.Speed
in the API response) over the upstream port table lookup, with fallback
to the port table if the device doesn't report a speed.

Fixes #189
Logs when the device's reported uplink speed differs from the upstream
port table, making it clear which value is being used for path tracing.
Tests verify that when a device's reported uplink speed differs from the
upstream port table (unmanaged switch scenario), the device's speed is
preferred. Also tests fallback to port table when device reports 0, and
confirms mesh APs continue to use wireless path.
Gateway UplinkSpeedMbps represents WAN speed, not LAN port speed.
Only apply the device-reported uplink speed preference for non-gateway
devices (APs, switches, modems, etc.).

Adds test to verify gateways use port table speed.
The fix should apply when going TOWARD gateway (uplink direction matches):
- Target device: uses device uplink speed ✓
- Intermediate hops in main loop: uses device uplink speed ✓

Return path (AWAY from gateway) correctly uses port table:
- Daisy-chain downstream: port table ✓
- Inter-VLAN return path: port table (except first hop ingress) ✓
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.

Wrong "Max link speed" assumption based on 10 GbE connection "in between" to unmanaged switch

1 participant