fix(ping): stop reporting every target alive
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m13s
driver / test (3.12) (pull_request) Successful in 4m9s
driver / test (3.13) (pull_request) Successful in 4m1s
driver / lowest (pull_request) Successful in 3m33s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 1m6s
CI / driver (pull_request) Successful in 5m49s
driver / publish (pull_request) Skipped

ping() returned three replies of 0 ms whenever the DAL accepted a
PINGTEST request, without reading any result, so a LAN scan through
this gateway marked every address alive. The DAL answer is only an
acknowledgement with no reply count, so ping() now returns NAPALM's
error reply without contacting the gateway and the driver opts out of
ping sweeps with SUPPORTS_PING = False.

Closes #2
This commit is contained in:
Christian Manivong committed 2026-11-01 21:56:45 +01:00
1 parent f7002114ae
commit fcee6d7ddd
4 files changed
+46 -23

No files matched your search

+11 -22
View File
@@ -33,6 +33,8 @@ from napalm_device_types.models import (
WirelessClientDict,
)
_PING_UNSUPPORTED = "Not supported on Zyxel VMG: the DAL does not report ping replies"
class ZyxelCrypto:
"""AES-256-CBC encryption wrapper for Zyxel DAL protocol payloads."""
@@ -96,6 +98,9 @@ class ZyxelVMGDriver(ResidentialGatewayDriver):
HTTP_FINGERPRINT = [
FingerprintRule("zyxel", weight=7.0, mandatory=True),
]
#: The DAL accepts a PINGTEST request but its answer carries no reply count or
#: round-trip time, so this driver cannot tell an answering host from a silent one.
SUPPORTS_PING = False
_LOGIN_PATH = "UserLogin"
_LOGOUT_PATH = "cgi-bin/UserLogout"
@@ -390,28 +395,12 @@ class ZyxelVMGDriver(ResidentialGatewayDriver):
vrf: str = "",
source_interface: str = "",
) -> dict[str, Any]:
"""Ping a destination via the device's DAL diagnostics."""
result = self._dal_query(
"PINGTEST",
{
"ProtocolVersion": "IPv4",
"Host": destination,
"DiagnosticsState": "Requested",
"DNSServer": "",
"NumberOfRepetitions": count,
"type": 0,
},
)
if result is None:
return {"success": {}, "error": "Ping not supported via DAL"}
return {
"success": {
"results": [{"rtt": 0}],
"probes_sent": count,
"probes_received": count,
},
"error": "",
}
"""Not supported: the DAL does not report whether a target answered.
Returns NAPALM's ``error`` reply without contacting the gateway; see
:attr:`SUPPORTS_PING`.
"""
return {"error": _PING_UNSUPPORTED}
def traceroute(
self,