dnsmasq: support DNS redirect for IPv6

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
(cherry picked from commit 7535adf0d1f4252f00f7c0ca0d03903a71543671)
This commit is contained in:
Tianling Shen 2021-06-22 17:33:45 +08:00
parent e8492b9f83
commit c8b98241ee
No known key found for this signature in database
GPG Key ID: 6850B6345C862176

View File

@ -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()