unbound-dhcp-leases-bridge: Fall back to the default domain
Commit Message
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>
---
config/unbound/unbound-dhcp-leases-bridge | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Comments
Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org>
Am 04.10.2022 um 15:32 schrieb Michael Tremer:
> 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>
> ---
> 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 1446c88df..e89e0446b 100644
> --- a/config/unbound/unbound-dhcp-leases-bridge
> +++ b/config/unbound/unbound-dhcp-leases-bridge
> @@ -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
@@ -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