diff --git a/napalm_fritzbox/fritzbox.py b/napalm_fritzbox/fritzbox.py index fcd6814..d826649 100644 --- a/napalm_fritzbox/fritzbox.py +++ b/napalm_fritzbox/fritzbox.py @@ -32,6 +32,7 @@ management methods (``load_merge_candidate``, ``commit_config``, ...). from __future__ import annotations +import logging import socket from typing import Any @@ -55,6 +56,12 @@ from napalm_device_types.models import ( WirelessClientDict, ) +logger = logging.getLogger(__name__) + +#: The remote host of a NAT translation whose port forward names none: any host. +#: Reported as data, never bound to. +_ANY_REMOTE = "0.0.0.0" # nosec B104 + # Exceptions that indicate an optional/unavailable TR-064 service or action # (e.g. a service not present on a given FritzOS version/model). _OPTIONAL_SERVICE_ERRORS = (FritzServiceError, FritzActionError, FritzConnectionException) @@ -469,6 +476,7 @@ class FritzBoxDriver(ResidentialGatewayDriver): ): continue except Exception: + logger.debug("WAN status from %s: ignored", svc, exc_info=True) continue if wan_service_used: @@ -619,7 +627,7 @@ class FritzBoxDriver(ResidentialGatewayDriver): continue if ":" in forward["internal_ip"]: continue - remote = forward.get("remote_host") or "0.0.0.0" + remote = forward.get("remote_host") or _ANY_REMOTE translations.append( { "protocol": forward["protocol"].lower(),