From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.haj.ipfire.org (localhost [IPv6:::1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4gQRkS4dFfz2y5m for ; Wed, 27 May 2026 11:10:56 +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) (Client CN "mail01.haj.ipfire.org", Issuer "R12" (not verified)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4gQRkS4GHFz2xJk for ; Wed, 27 May 2026 11:10:56 +0000 (UTC) Received: from people01.haj.ipfire.org (people01.haj.ipfire.org [172.28.1.161]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (Client CN "people01.haj.ipfire.org", Issuer "E8" (not verified)) by mail01.ipfire.org (Postfix) with ESMTPS id 4gQRkS0m33z2rW for ; Wed, 27 May 2026 11:10:56 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1779880256; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc; bh=NhJ6o+K5jieshQMeabmgVgg8ZIFuwtBth/HVADBmbcs=; b=utiQzDdvlg7KzxZFvPzuhy8Pz9ZUdCPTUZosz2K6sAw1P8gM0Z4mmAkcE0wUOWBrJ9fSqD Q51wWjDjzIRMW5CQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1779880256; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc; bh=NhJ6o+K5jieshQMeabmgVgg8ZIFuwtBth/HVADBmbcs=; b=axE9C4jKKAtrwG08lbv2+Db+Savz6gTlk29RSXcGFRPf7cxF/pi9h7WIpihb0D5Nk68lU0 BHBJsDJwfQAcHOCej6EIQFP5LngtIqiQswkMYXod0SiGVUw8OEym4DDh7U/JHLvdeuvsSj pHPFRv/60kvAa6kiikNeaDlIgPTUFm9Azs04s+7Ry8tX8bQ8NFFeIzxRmHF8S3wA52x4Po WtU2SPQ75k9+jiRD2HF0EPURDpMshERwZtpcYOOmlaeb8fopxvf07LW0eKNz43byWeN3AR UmmAFr5fWxIsc+371ClUO69ESPWqFiEvU9g4x9evHc89nGHWMh6HAAZxUffKnQ== Received: by people01.haj.ipfire.org (Postfix, from userid 1000) id 4gQRkR5rjGz2xKs; Wed, 27 May 2026 11:10:55 +0000 (UTC) To: ipfire-scm@lists.ipfire.org Subject: [git.ipfire.org] IPFire 2.x development tree branch, next, updated. ef08f8ca36b32203d08d2a5d6d9d7850eda5bd9f X-Git-Refname: refs/heads/next X-Git-Reftype: branch X-Git-Oldrev: 4494939c7e41c144d040daf24a7b2bc0371f1d16 X-Git-Newrev: ef08f8ca36b32203d08d2a5d6d9d7850eda5bd9f Message-Id: <4gQRkR5rjGz2xKs@people01.haj.ipfire.org> Date: Wed, 27 May 2026 11:10:55 +0000 (UTC) From: Michael Tremer Precedence: list List-Id: List-Subscribe: , List-Unsubscribe: , List-Post: List-Help: Sender: Mail-Followup-To: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "IPFire 2.x development tree". The branch, next has been updated via ef08f8ca36b32203d08d2a5d6d9d7850eda5bd9f (commit) via b725c89d8c34400df4342a265474a8c37ee1c3e1 (commit) via 79edbe52bba41ca998f3bfeec8930c6faf6e0b8a (commit) via 745104e06a9e53b72ebe3529dcefd005438c7618 (commit) from 4494939c7e41c144d040daf24a7b2bc0371f1d16 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ef08f8ca36b32203d08d2a5d6d9d7850eda5bd9f Author: Michael Tremer Date: Wed May 27 12:10:02 2026 +0100 knot resolver: Backup the leases database Signed-off-by: Michael Tremer commit b725c89d8c34400df4342a265474a8c37ee1c3e1 Author: Michael Tremer Date: Wed May 27 12:09:25 2026 +0100 knot resolver: Rename the leases database It should simply be called like the module is called. Signed-off-by: Michael Tremer commit 79edbe52bba41ca998f3bfeec8930c6faf6e0b8a Author: Michael Tremer Date: Wed May 27 12:07:56 2026 +0100 knot resolver: Create the leases database at build time Signed-off-by: Michael Tremer commit 745104e06a9e53b72ebe3529dcefd005438c7618 Author: Michael Tremer Date: Wed May 27 12:04:18 2026 +0100 knot-resolver: Move the leases schema into a separate file Signed-off-by: Michael Tremer ----------------------------------------------------------------------- Summary of changes: config/backup/include | 1 + config/knot-resolver/dhcp-lease | 22 ++++++---------------- config/knot-resolver/leases.lua | 2 +- config/knot-resolver/leases.schema | 13 +++++++++++++ config/rootfiles/common/knot-resolver | 2 ++ lfs/knot-resolver | 8 ++++++++ 6 files changed, 31 insertions(+), 17 deletions(-) create mode 100644 config/knot-resolver/leases.schema Difference in files: diff --git a/config/backup/include b/config/backup/include index b547d1520..92b3510be 100644 --- a/config/backup/include +++ b/config/backup/include @@ -56,6 +56,7 @@ var/ipfire/urlfilter var/ipfire/vpn var/ipfire/wireguard var/lib/ipblocklist +var/lib/knot-resolver/leases.db var/lib/suricata var/log/ip-acct/* var/log/rrd/* diff --git a/config/knot-resolver/dhcp-lease b/config/knot-resolver/dhcp-lease index 982bd3566..5dcfeaa7e 100644 --- a/config/knot-resolver/dhcp-lease +++ b/config/knot-resolver/dhcp-lease @@ -1,25 +1,15 @@ #!/bin/bash -readonly DB_PATH="/var/lib/knot-resolver/dhcp-leases.db" +readonly DB_PATH="/var/lib/knot-resolver/leases.db" main() { # Create the database if it does not exist if [ ! -f "${DB_PATH}" ]; then - sqlite3 "${DB_PATH}" >/dev/null </dev/null \ + &2 + return 1 + fi fi local action="${1}" diff --git a/config/knot-resolver/leases.lua b/config/knot-resolver/leases.lua index a78a800c5..e07885e60 100644 --- a/config/knot-resolver/leases.lua +++ b/config/knot-resolver/leases.lua @@ -1,7 +1,7 @@ -- Load modules local sqlite3 = require("lsqlite3") -local DB_PATH = "/var/lib/knot-resolver/dhcp-leases.db" +local DB_PATH = "/var/lib/knot-resolver/leases.db" local TTL = 60 local M = {} diff --git a/config/knot-resolver/leases.schema b/config/knot-resolver/leases.schema new file mode 100644 index 000000000..23587939c --- /dev/null +++ b/config/knot-resolver/leases.schema @@ -0,0 +1,13 @@ +CREATE TABLE IF NOT EXISTS leases( + address TEXT PRIMARY KEY, + hostname TEXT NOT NULL +); + +CREATE UNIQUE INDEX IF NOT EXISTS + leases_address ON leases(address); +CREATE UNIQUE INDEX IF NOT EXISTS + leases_hostname ON leases(hostname COLLATE NOCASE); + +-- Run in WAL mode +PRAGMA journal_mode=WAL; +PRAGMA synchronous=NORMAL; diff --git a/config/rootfiles/common/knot-resolver b/config/rootfiles/common/knot-resolver index 67068f984..11f90b165 100644 --- a/config/rootfiles/common/knot-resolver +++ b/config/rootfiles/common/knot-resolver @@ -100,6 +100,7 @@ usr/lib/knot-resolver/kres_modules/view.lua usr/lib/knot-resolver/kres_modules/watchdog.lua usr/lib/knot-resolver/kres_modules/workarounds.lua usr/lib/knot-resolver/krprint.lua +usr/lib/knot-resolver/leases.schema usr/lib/knot-resolver/postconfig.lua usr/lib/knot-resolver/sandbox.lua usr/lib/knot-resolver/trust_anchors.lua @@ -269,4 +270,5 @@ usr/sbin/kresd #usr/share/man/man8/kresd.8 var/cache/knot-resolver var/lib/knot-resolver +var/lib/knot-resolver/leases.db var/lib/knot-resolver/root.keys diff --git a/lfs/knot-resolver b/lfs/knot-resolver index 451f605bf..5ca378f1e 100644 --- a/lfs/knot-resolver +++ b/lfs/knot-resolver @@ -102,6 +102,14 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) install -v -m 644 $(DIR_SRC)/config/knot-resolver/leases.lua \ /usr/lib/knot-resolver/kres_modules/leases.lua + # Install the leases schema + install -v -m 6444 $(DIR_SRC)/config/knot-resolver/leases.schema \ + /usr/lib/knot-resolver/leases.schema + + # Create the leases database + sqlite3 "/var/lib/knot-resolver/leases.db" \ + < /usr/lib/knot-resolver/leases.schema + # Install the DHCP leases helper script install -v -m 755 $(DIR_SRC)/config/knot-resolver/dhcp-lease \ /usr/sbin/dhcp-lease hooks/post-receive -- IPFire 2.x development tree