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.
This commit is contained in:
Patrick Grupp
2022-12-13 19:54:41 +01:00
committed by GitHub
parent 7144429a96
commit 134097983f
2 changed files with 2 additions and 1 deletions
+1
View File
@@ -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
@@ -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