OSDN Git Service

dnsmasq: use inet family & fix ruleset order
authorZiMing Mo <msylgj@immortalwrt.org>
Wed, 25 May 2022 06:14:15 +0000 (14:14 +0800)
committerZiMing Mo <msylgj@immortalwrt.org>
Wed, 25 May 2022 06:14:15 +0000 (14:14 +0800)
package/network/services/dnsmasq/files/dnsmasq.init

index 95a33d9..7dbb531 100755 (executable)
@@ -1190,15 +1190,9 @@ dnsmasq_start()
        config_get dns_port "$cfg" port 53
        if [ "$dns_redirect" = 1 ]; then
                cat > /tmp/dnsmasq-dns-redirect.nft <<EOF
-table ip dnsmasq {
+table inet dnsmasq {
        chain prerouting {
-               type nat hook prerouting priority dstnat; policy accept;
-               udp dport 53 counter redirect to :$dns_port comment "DNSMASQ";
-       }
-}
-table ip6 dnsmasq {
-       chain prerouting {
-               type nat hook prerouting priority dstnat; policy accept;
+               type nat hook prerouting priority -105; policy accept;
                udp dport 53 counter redirect to :$dns_port comment "DNSMASQ";
        }
 }
@@ -1224,11 +1218,10 @@ dnsmasq_stop()
 
 nftables_clear()
 {
-       nft --check list table ip dnsmasq > /dev/null 2>&1
+       nft --check list table inet dnsmasq > /dev/null 2>&1
        if [ $? -eq "0" ]; then
                echo "Remove dnsmasq nat table"
-               nft delete table ip dnsmasq
-               nft delete table ip6 dnsmasq
+               nft delete table inet dnsmasq
        fi
 }