From d344d0a773c9feea8893710112474d6dc8115536 Mon Sep 17 00:00:00 2001 From: Gareth Owen Date: Tue, 23 Feb 2021 02:53:41 -0500 Subject: [PATCH] Unbound: Fix bad dereference when DHCP lease expires (#4742) Move deletion of dhcp cache info when the lease expires to after the last reference to the cache information. Fixes #4741 --- src/opnsense/scripts/dns/unbound_dhcpd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opnsense/scripts/dns/unbound_dhcpd.py b/src/opnsense/scripts/dns/unbound_dhcpd.py index 22d8d6fa5..6a9bcd550 100755 --- a/src/opnsense/scripts/dns/unbound_dhcpd.py +++ b/src/opnsense/scripts/dns/unbound_dhcpd.py @@ -130,10 +130,10 @@ def run_watcher(target_filename, domain): "dhcpd expired %s @ %s" % (cached_leases[address]['client-hostname'], address) ) unbound_control(['local_data_remove', cached_leases[address]['client-hostname']]) - del cached_leases[address] fqdn = '%s.%s' % (cached_leases[address]['client-hostname'], domain) if unbound_local_data.is_equal(address, fqdn): unbound_local_data.cleanup(address, fqdn) + del cached_leases[address] dhcpd_changed = True if dhcpd_changed: