nft "add rule inet $NFT_TABLE postnat meta nfproto ipv${IPV}$1 dport $2 mark and $DESYNC_MARK!= $DESYNC_MARK ip${ipver} daddr {$iplist} queue num $QNUM"
nft "add rule inet $NFT_TABLE postnat meta nfproto ipv${IPV}$1 dport $2 mark and $DESYNC_MARK== 0 ip${ipver} daddr {$iplist} ct mark set ct mark or $DESYNC_MARK queue num $QNUM"
# for strategies with incoming packets involved (autottl)
add set inet $ZAPRET_NFT_TABLE lanif {type ifname;}
@ -119,6 +119,20 @@ EOF
nft_flush_chain predefrag_nfqws
nft_add_rule predefrag_nfqws notrack comment \"do not track nfqws generated packets to avoid nat tampering and defragmentation\"
}
["$FILTER_TTL_EXPIRED_ICMP"=1]&&{
if is_postnat;then
# can be caused by untracked nfqws-generated packets
nft_add_rule prerouting icmp type time-exceeded ct state invalid drop
else
nft_add_rule postrouting_hook mark and $DESYNC_MARK !=0 ct mark set ct mark or $DESYNC_MARK comment \"nfqws related : prevent ttl expired socket errors\"
fi
["$DISABLE_IPV4"="1"]||{
nft_add_rule prerouting icmp type time-exceeded ct mark and $DESYNC_MARK !=0 drop comment \"nfqws related : prevent ttl expired socket errors\"
}
["$DISABLE_IPV6"="1"]||{
nft_add_rule prerouting icmpv6 type time-exceeded ct mark and $DESYNC_MARK !=0 drop comment \"nfqws related : prevent ttl expired socket errors\"