dnsmasq: cleanup nftables hijack commands
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
parent
2f87aee77c
commit
3d918ce54d
@ -1220,15 +1220,9 @@ dnsmasq_start()
|
||||
config_get_bool dns_redirect "$cfg" dns_redirect 0
|
||||
config_get dns_port "$cfg" port 53
|
||||
if [ "$dns_redirect" = 1 ]; then
|
||||
cat <<-EOF > /tmp/dnsmasq-dns-redirect.nft
|
||||
table inet dnsmasq {
|
||||
chain prerouting {
|
||||
type nat hook prerouting priority -105; policy accept;
|
||||
meta nfproto {ipv4, ipv6} udp dport 53 counter redirect to :$dns_port comment "DNSMASQ";
|
||||
}
|
||||
}
|
||||
EOF
|
||||
nft -f /tmp/dnsmasq-dns-redirect.nft
|
||||
nft add table inet dnsmasq
|
||||
nft add chain inet dnsmasq prerouting "{ type nat hook prerouting priority -105; policy accept; }"
|
||||
nft add rule inet dnsmasq prerouting "meta nfproto { ipv4, ipv6 } udp dport 53 counter redirect to :53 comment \"DNSMASQ HIJACK\""
|
||||
fi
|
||||
}
|
||||
|
||||
@ -1249,11 +1243,8 @@ dnsmasq_stop()
|
||||
|
||||
nftables_clear()
|
||||
{
|
||||
nft --check list table inet dnsmasq > /dev/null 2>&1
|
||||
if [ $? -eq "0" ]; then
|
||||
echo "Remove dnsmasq nat table"
|
||||
! nft --check list table inet dnsmasq > "/dev/null" 2>&1 || \
|
||||
nft delete table inet dnsmasq
|
||||
fi
|
||||
}
|
||||
|
||||
add_interface_trigger()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user