dnsmasq: support DNS redirect for IPv6

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

View File

@ -1121,7 +1121,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()