Skip to content

fix(udm-wan-monitor): show the same WAN IP and IPv6 as UniFi Network - #15

Draft
lennard0711 wants to merge 2 commits into
itsDNNS:mainfrom
lennard0711:feat/udm-wan-display-consistency
Draft

lennard0711 wants to merge 2 commits into
itsDNNS:mainfrom
lennard0711:feat/udm-wan-display-consistency

Conversation

@lennard0711

Copy link
Copy Markdown

Builds on the UCG support PR (#14, 3.2.0) and bumps the module to 3.2.1. Please merge that one first; until then this PR also shows its commit.

Hi @Oggy512, this is a small follow-up from my UCG Ultra setup. If you have a UDM, it would be great if you could confirm the dashboard values look right there as well.

Summary

The WAN cards showed values that differ from what UniFi Network shows for the same WAN. Observed on a UCG Ultra whose WAN 2 sits behind another router (double NAT) and has no IPv6.

Changes

  • IP: show the WAN interface's own address, as UniFi Network does. Previously the geo-detected public address was preferred, so WAN 2 showed 80.x.x.x while UniFi showed the private 192.168.0.x. The public address is kept as ip_public and shown in an extra "Public IP" row only when it differs from the interface IP, so no information is lost. On a direct connection both are identical and the row stays hidden.
  • IPv6: skip link-local (fe80::/10) addresses. UniFi lists the interface's link-local address first, so an uplink without IPv6 displayed a link-local address as if it had IPv6.
  • label_ip_public added to the en/de/fr/es translations.
  • Version 3.2.0 → 3.2.1.

Event messages use the same IP, so they now name the interface address.

Testing

  • python3 -m unittest discover -s tests and scripts/validate_registry.py pass.
  • Checked in the dashboard against a UCG Ultra: WAN 1 (direct) shows one IP plus IPv6, WAN 2 (double NAT, no IPv6) shows the private IP, the Public IP row and no IPv6.
  • Not tested on a UDM.

…UniFi WAN-Monitor, fix polling on current DOCSight

Verified against a UCG Ultra (UDRULT, UniFi OS 5.1.33), including a real
failover (WAN 1 unplugged and reconnected).

- Derive WAN port names from the gateway's wan1/wan2 ifname instead of
  hardcoding the UDM Pro's eth9/eth8 (UCG Ultra: eth4/eth0), so it follows
  whichever ports are assigned as WAN, including reassigned LAN ports. Only
  wan1 and wan2 are considered; a WAN that is not configured produces no
  row. Dashboard cards show the real ifname.
- Select the gateway by type (udm/ugw/usg/ucg) and presence of wan1; never
  fall back to devices[0], which could be a switch or AP and would report a
  bogus offline WAN. Fail with "No gateway device found" or "No WAN interface
  (wan1/wan2) found on gateway" instead.
- Fix CollectorResult.ok()/failure() no longer existing in current DOCSight
  (every poll was recorded as a failure). Helpers use them only if present.
- Reuse the collector's session for dashboard requests and only fall back to
  the legacy /api/login on 404/405. A login per request tripped UniFi OS'
  login rate limit (429), which was then masked as a 401.
- Rename the module to "UniFi WAN-Monitor" (display name only; module id,
  directory, routes and event type are unchanged) and mention UCG in the
  texts.
- Version 3.2.0.
- IP: show the WAN interface's own address, as UniFi Network does. Behind
  another router (double NAT) that is a private address, so the previous
  geo-detected public address looked wrong next to the UniFi dashboard.
  The public address stays available as ip_public and is shown in an extra
  "Public IP" row only when it differs from the interface IP.
- IPv6: skip link-local (fe80::/10) addresses. UniFi lists them first, so an
  uplink without IPv6 showed a link-local address as if it had one.
- Add label_ip_public translations (en, de, fr, es).
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