From 30afe247680660de367253a66d426da5e4884e3f Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 3 Dec 2026 03:08:09 +0000 Subject: dnsmasq: configure hrm.nftables directly The forward chain accepts established and related connections itself. --- modules/dnsmasq.nix | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'modules') diff --git a/modules/dnsmasq.nix b/modules/dnsmasq.nix index b12cea38..6cd927c4 100644 --- a/modules/dnsmasq.nix +++ b/modules/dnsmasq.nix @@ -37,23 +37,24 @@ in { dhcp-range=${cfg.dhcp-range} listen-address=${cfg.address} ''; - tv.iptables.extra.filter.INPUT = [ - "-i ${cfg.interface} -p tcp -m tcp --dport bootps -j ACCEPT" - "-i ${cfg.interface} -p udp -m udp --dport bootps -j ACCEPT" - "-i ${cfg.interface} -p tcp -m tcp --dport domain -j ACCEPT" - "-i ${cfg.interface} -p udp -m udp --dport domain -j ACCEPT" - ]; + hrm.nftables.tables.filter.chains.input.rules.dnsmasq = { + order = 1500; + iifname = cfg.interface; + tcp.dport = [ "bootps" "domain" ]; + udp.dport = [ "bootps" "domain" ]; + verdict = "accept"; + }; } { # enable forwarding boot.kernel.sysctl."net.ipv4.ip_forward" = true; - tv.iptables.extra.filter.FORWARD = [ - "-m state --state RELATED,ESTABLISHED -j ACCEPT" - "-i ${cfg.interface} -j ACCEPT" - ]; - tv.iptables.extra.nat.POSTROUTING = [ - "-j MASQUERADE" - ]; + hrm.nftables.tables.filter.chains.forward.rules.dnsmasq = { + iifname = cfg.interface; + verdict = "accept"; + }; + hrm.nftables.tables.nat.chains.postrouting.rules.dnsmasq = { + verdict = "masquerade"; + }; } ]); -- cgit v1.3.1 [cgit] Unable to lock slot /tmp/cgit/13000000.lock: Permission denied (13)