From 038c9db2bda048ff184e1fb9b4e2ef9b0ee1ff7b Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 10 May 2024 17:04:43 +0100 Subject: [PATCH] unbound-dhcp-leases-bridge: Use IPv4Address to store IP addresses Signed-off-by: Michael Tremer --- config/unbound/unbound-dhcp-leases-bridge | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/config/unbound/unbound-dhcp-leases-bridge b/config/unbound/unbound-dhcp-leases-bridge index b4e212b38..604a172de 100644 --- a/config/unbound/unbound-dhcp-leases-bridge +++ b/config/unbound/unbound-dhcp-leases-bridge @@ -481,6 +481,9 @@ class FixLeases(object): class Lease(object): def __init__(self, ipaddr, properties): + if not isinstance(ipaddr, ipaddress.IPv4Address): + ipaddr = ipaddress.IPv4Address(ipaddr) + self.ipaddr = ipaddr self._properties = properties @@ -631,10 +634,10 @@ class Lease(object): return [ # Forward record - (self.fqdn, "%s" % LOCAL_TTL, "IN A", self.ipaddr), + (self.fqdn, "%s" % LOCAL_TTL, "IN A", "%s" % self.ipaddr), # Reverse record - (ip_address_to_reverse_pointer(self.ipaddr), "%s" % LOCAL_TTL, + (self.ipaddr.reverse_pointer, "%s" % LOCAL_TTL, "IN PTR", self.fqdn), ] -- 2.39.5