From patchwork Tue Oct 4 13:32:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 6040 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4Mhdtc05Snz3wcJ for ; Tue, 4 Oct 2022 13:32:55 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4MhdtZ3sGnz1TN; Tue, 4 Oct 2022 13:32:54 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4MhdtZ1z45z2xPQ; Tue, 4 Oct 2022 13:32:54 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4MhdtX2ptwz2xJQ for ; Tue, 4 Oct 2022 13:32:52 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4MhdtW3HNdz1Qw; Tue, 4 Oct 2022 13:32:51 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1664890371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Az1xcrjLJa6EHy9FiDX0clNJ3ehnE9eUKDxer7Hgw2w=; b=49roAtjLex3zUUmklAyTSuqi9V2B0/i8kKYPVE7qT/dzSN46sGvWFqJmCHrwl8DFz87053 P/D1MU6ebhFIYDCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1664890371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Az1xcrjLJa6EHy9FiDX0clNJ3ehnE9eUKDxer7Hgw2w=; b=tNbLlufIk5lfns3X+VArySkK35GwkXZcKbFYvLmIUMXB2vKwwLRxY9xrG2tAV7sArRhtFS tjfIEaPDy52p3lR+MaPAiR1EkbUd3re9BTRV5ploiW4hcl0PsPZt5AJdXWTTSGAGusWzp3 YqAjYh/QAcToWZAdmFysKgf5n2IhP0Ln/XG+B0mCJZo9QSw/EYreEfDe8n8hYbe3q9nRhn ZJdJJa4UkIfv5XIchKdnSaxjZ136MeciJC8jCxO59UAYWLptuwrDTvauVx/nwEpOWpxkqq 3mOGkQC9XnTpO6p8koHgJ//AYZBuPyiTxwI3aOJ0PaQR9ibGTSEwhla4zJ2f0Q== From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH] unbound-dhcp-leases-bridge: Fall back to the default domain Date: Tue, 4 Oct 2022 13:32:47 +0000 Message-Id: <20221004133247.3915028-1-michael.tremer@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Tremer Errors-To: development-bounces@lists.ipfire.org Sender: "Development" 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 Reviewed-by: Bernhard Bitsch --- 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