From 134097983f6841938e500e747f484abcb0e91921 Mon Sep 17 00:00:00 2001 From: Patrick Grupp Date: Tue, 13 Dec 2022 19:54:41 +0100 Subject: [PATCH] dns/ddclient: Fix IPv6 address parsing from external service (#3217) When using external services to determine the public IPv6 address of an interface, the bounds are too limited for short (but valid) IPv6 addresses. Reducing the necessary amount of colon characters in the resolved IPv6 address for the `checkip` script to accept them fixes this issue. --- dns/ddclient/pkg-descr | 1 + dns/ddclient/src/opnsense/scripts/ddclient/checkip | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dns/ddclient/pkg-descr b/dns/ddclient/pkg-descr index 1b392f36a..761df3b6b 100644 --- a/dns/ddclient/pkg-descr +++ b/dns/ddclient/pkg-descr @@ -23,6 +23,7 @@ Plugin Changelog * Add sitelutions support (contributed by Luca Schoeneberg) * Add woima support (contributed by Luca Schoeneberg) * Add Yandex support (contributed by Luca Schoeneberg) +* Fix parsing short IPv6 addresses from external service (contributed by Patrick Grupp) 1.9 diff --git a/dns/ddclient/src/opnsense/scripts/ddclient/checkip b/dns/ddclient/src/opnsense/scripts/ddclient/checkip index 35e224405..b8d7ffe3d 100755 --- a/dns/ddclient/src/opnsense/scripts/ddclient/checkip +++ b/dns/ddclient/src/opnsense/scripts/ddclient/checkip @@ -57,7 +57,7 @@ def extract_address(txt): """ for regexp in [r'[^a-fA-F0-9\:]', r'[^F0-9\.]']: for line in re.sub(regexp, ' ', txt).split(): - if line.count('.') == 3 or line.count(':') > 4: + if line.count('.') == 3 or line.count(':') >= 2: try: ipaddress.ip_address(line) return line