From 1792c6922320e3b35e11929f585c4510fa7c7861 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Mon, 8 Nov 2021 23:34:33 +0100 Subject: [PATCH] strip prefix-length / netmask if present, fixes #470 --- src/nsupdate/api/views.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/nsupdate/api/views.py b/src/nsupdate/api/views.py index bd7cd6e..7be115e 100644 --- a/src/nsupdate/api/views.py +++ b/src/nsupdate/api/views.py @@ -355,6 +355,10 @@ def _update_or_delete(host, ipaddr, secure=False, logger=None, _delete=False): # https://github.com/rthalley/dnspython/issues/41 # TODO: reproduce and submit traceback to issue 41 ipaddr = str(ipaddr) + if '/' in ipaddr: + # looks like there is a trailing /xx prefix length / netmask - get rid of it. + # by doing this we support myip= of FritzBox. + ipaddr = ipaddr.rsplit('/')[0] kind = check_ip(ipaddr, ('ipv4', 'ipv6')) rdtype = 'A' if kind == 'ipv4' else 'AAAA' IPNetwork(ipaddr) # raise AddrFormatError here if there is an issue with ipaddr, see #394