fix(wan): read the uplink from the gateway's status page (#29)

get_wan_status built its answer from WanIp, WanAccessType,
SystemUpTime, MaxUpstream and MaxDownstream in getBasicInformation.
A VMG4005-B50A sends none of them there, so every gateway's uplink
read as down, with no address and no sync rate; get_nat_translations
built inside_global from the same WanIp and reported ":<port>".

Both now read the DAL's cardpage_status. A bridge has no WAN address
of its own, so it is connected when its DSL line is in sync (a
DslChannelInfo entry with Status "Up"); a router is connected when a
WAN interface that is not IP_Bridged is up with an address. The sync
rates are those of the channels in sync, added up for bonded lines;
a channel out of sync keeps its last rates, which are not reported.
A translation without a WAN address goes to 0.0.0.0, and without
enabled port forwards the status page is not read at all.

The tests read the recorded, anonymised status page of a
VMG4005-B50A bridge whose line was not in sync; the in-sync and
router states are derived from it.

Closes #29
This commit is contained in:
Christian Manivong committed 2026-11-12 19:05:48 +01:00
1 parent a47f9c3970
commit 3213dfaaaa
7 files changed
+672 -28

No files matched your search

+13
View File
@@ -13,6 +13,19 @@ All notable changes to this driver. The format follows
3.12 venv no longer has.
### Fixed
- `get_wan_status()` reports the gateway's uplink as the gateway does (#29). It read
`WanIp`, `WanAccessType`, `SystemUpTime`, `MaxUpstream` and `MaxDownstream` from
`getBasicInformation`, which a VMG4005-B50A does not send them in, and reported
every uplink as down, with no address and no sync rate. It now reads the DAL's
`cardpage_status`: a bridge is connected when its DSL line is in sync and has no
external address of its own; a router is connected when a WAN interface that is
not a bridge is up with an address, which is then `external_ip`. `link_status` is
`"Up"` while the DSL line is in sync, the sync rates are those of the channels in
sync (added up for bonded lines), and `connection_type` is `"DSL"` for a bridge,
the WAN's encapsulation (`"PPPoE"`, `"IPoE"`) for a router. Byte counters are not
read and stay `0`.
- `get_nat_translations()` translates to the gateway's WAN address from the same page,
and to `0.0.0.0` when it has none; it reported `":<port>"` (#29).
- `get_hosts()`, `get_arp_table()` and `get_port_forwards()` report what the gateway
has (#25). They parsed the DAL's answer without decrypting it, found none of their
keys in the sealed envelope and reported nothing, on every gateway; the Wi-Fi