From c8b98241ee6f2706cbf3b69da1c6f19ab08bb2b1 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Tue, 22 Jun 2021 17:33:45 +0800 Subject: [PATCH] dnsmasq: support DNS redirect for IPv6 Signed-off-by: Tianling Shen (cherry picked from commit 7535adf0d1f4252f00f7c0ca0d03903a71543671) --- package/network/services/dnsmasq/files/dnsmasq.init | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init index 9dc17cfeb2..883821ed4a 100644 --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -1117,7 +1117,10 @@ dnsmasq_start() config_get_bool dns_redirect "$cfg" dns_redirect 0 config_get dns_port "$cfg" port 53 - [ "$dns_redirect" = 1 ] && iptables -t nat -A PREROUTING -m comment --comment "DNSMASQ" -p udp --dport 53 -j REDIRECT --to-ports $dns_port + if [ "$dns_redirect" = 1 ]; then + iptables -t nat -A PREROUTING -m comment --comment "DNSMASQ" -p udp --dport 53 -j REDIRECT --to-ports $dns_port + [ -n "$(command -v ip6tables)" ] && ip6tables -t nat -A PREROUTING -m comment --comment "DNSMASQ" -p udp --dport 53 -j REDIRECT --to-ports $dnsport + fi } dnsmasq_stop()