]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
unbound-dhcp-leases-bridge: Fall back to the default domain
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 4 Oct 2022 13:32:47 +0000 (13:32 +0000)
committerPeter Müller <peter.mueller@ipfire.org>
Tue, 4 Oct 2022 14:48:26 +0000 (14:48 +0000)
When the bridge cannot detect a domain name for any of the leases, it
uses localdomain which is not always the best choice. So instead, this
patches changes the behaviour that we read the default domain of the
firewall.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org>
config/unbound/unbound-dhcp-leases-bridge

index 1446c88dfd7f14d14cd6fa2f2b1be1d1d86533cc..e89e0446b48e90e92a5a812db36c19226fc042dd 100644 (file)
@@ -441,8 +441,11 @@ class Lease(object):
                        if address in subnet:
                                return subnets[subnet]
 
-               # Fall back to localdomain if no match could be found
-               return "localdomain"
+               # Load main settings
+               settings = self.read_settings("/var/ipfire/main/settings")
+
+               # Fall back to the host domain if no match could be found
+               return settings.get("DOMAINNAME", "localdomain")
 
        @staticmethod
        @functools.cache