mirror of
https://github.com/bol-van/zapret2.git
synced 2026-06-17 12:50:04 +04:00
zapret-lib: call apply_arg_prefix right before instance execute
This commit is contained in:
@@ -265,3 +265,4 @@ v0.9.4.3
|
|||||||
* winws2, dvtws2: ASLR
|
* winws2, dvtws2: ASLR
|
||||||
* github, linux-builder: reduce arm executable size by 20% - move to armv7+thumb
|
* github, linux-builder: reduce arm executable size by 20% - move to armv7+thumb
|
||||||
* init.d: warn if hostlist/ipset files are inside zapret2 root
|
* init.d: warn if hostlist/ipset files are inside zapret2 root
|
||||||
|
* zapret-lib: do not call apply_arg_prefix in apply_execution_plan - call it right before instance execute
|
||||||
|
|||||||
+4
-1
@@ -3531,7 +3531,7 @@ Checks the [instance cutoff](#instance_cutoff) state for `desync.func_instance`
|
|||||||
function apply_arg_prefix(desync)
|
function apply_arg_prefix(desync)
|
||||||
```
|
```
|
||||||
|
|
||||||
Performs substitution of argument values from `desync.arg` that start with `%` and `#`.
|
Performs substitution of argument values from `desync.arg` that start with `%`, `#`, `\`.
|
||||||
|
|
||||||
### apply_execution_plan
|
### apply_execution_plan
|
||||||
|
|
||||||
@@ -3540,6 +3540,7 @@ function apply_execution_plan(desync, instance)
|
|||||||
```
|
```
|
||||||
|
|
||||||
Copies the instance identification and its arguments from an [execution plan](#execution_plan) `instance` into the desync object, thereby recreating the desync state as if the `instance` were called directly by C code.
|
Copies the instance identification and its arguments from an [execution plan](#execution_plan) `instance` into the desync object, thereby recreating the desync state as if the `instance` were called directly by C code.
|
||||||
|
With one exception : apply_arg_prefix is not applied because args can refer a blob created by previous conditionally executed instances.
|
||||||
The [execution plan](#execution_plan) is provided by the C function `execution_plan()` as an array of `instance` elements.
|
The [execution plan](#execution_plan) is provided by the C function `execution_plan()` as an array of `instance` elements.
|
||||||
|
|
||||||
### verdict_aggregate
|
### verdict_aggregate
|
||||||
@@ -3558,6 +3559,7 @@ function plan_instance_execute_preapplied(desync, verdict, instance)
|
|||||||
```
|
```
|
||||||
|
|
||||||
Executes an [execution plan](#execution_plan) `instance`, taking into account the [instance cutoff](#instance_cutoff) and standard [payload](#in-profile-filters) and [range](#in-profile-filters) filters.
|
Executes an [execution plan](#execution_plan) `instance`, taking into account the [instance cutoff](#instance_cutoff) and standard [payload](#in-profile-filters) and [range](#in-profile-filters) filters.
|
||||||
|
Calls apply_arg_prefix right before calling the instance.
|
||||||
Returns the aggregation of the current verdict and the `instance` verdict.
|
Returns the aggregation of the current verdict and the `instance` verdict.
|
||||||
|
|
||||||
The "preapplied" version does not apply execution plan, allowing the calling code to do so.
|
The "preapplied" version does not apply execution plan, allowing the calling code to do so.
|
||||||
@@ -4479,6 +4481,7 @@ function cond_lua(desync)
|
|||||||
```
|
```
|
||||||
|
|
||||||
Executes a Lua code from the "cond_code" argument. The code returns condition value. Direct addressing of the desync table is possible within the code.
|
Executes a Lua code from the "cond_code" argument. The code returns condition value. Direct addressing of the desync table is possible within the code.
|
||||||
|
desync.arg is passed without called "apply_arg_prefix" : `%`, `#`, `\` remain as is without substitution because can refer blobs created by previous conditionally executed instances.
|
||||||
|
|
||||||
|
|
||||||
# Auxiliary programs
|
# Auxiliary programs
|
||||||
|
|||||||
+4
-1
@@ -3709,7 +3709,7 @@ function cutoff_shim_check(desync)
|
|||||||
function apply_arg_prefix(desync)
|
function apply_arg_prefix(desync)
|
||||||
```
|
```
|
||||||
|
|
||||||
Выполняет подстановку значений аргументов из desync.arg, начинающихся с `%` и `#`.
|
Выполняет подстановку значений аргументов из desync.arg, начинающихся с `%` и `#`, `\`.
|
||||||
|
|
||||||
### apply_execution_plan
|
### apply_execution_plan
|
||||||
|
|
||||||
@@ -3719,6 +3719,7 @@ function apply_execution_plan(desync, instance)
|
|||||||
|
|
||||||
Копирует в desync идентификацию инстанса и его аргументы из элемента [execution plan](#execution_plan) `instance`,
|
Копирует в desync идентификацию инстанса и его аргументы из элемента [execution plan](#execution_plan) `instance`,
|
||||||
тем самым воссоздает состояние desync, как если бы `instance` был вызван напрямую C кодом.
|
тем самым воссоздает состояние desync, как если бы `instance` был вызван напрямую C кодом.
|
||||||
|
За одним исключением : apply_arg_prefix не применяется, поскольку может содержать несуществующие блоб, существование которого зависит от условного выполнения предыдущих истансов.
|
||||||
[execution plan](#execution_plan) выдается C функцией `execution_plan()` как массив, элементами которого являются `instance`.
|
[execution plan](#execution_plan) выдается C функцией `execution_plan()` как массив, элементами которого являются `instance`.
|
||||||
|
|
||||||
### verdict_aggregate
|
### verdict_aggregate
|
||||||
@@ -3737,6 +3738,7 @@ function plan_instance_execute_preapplied(desync, verdict, instance)
|
|||||||
```
|
```
|
||||||
|
|
||||||
Выполняет элемент [execution plan](#execution_plan) `instance` с учетом [instance cutoff](#instance_cutoff) и стандартных фильтров [payload](#внутрипрофильные-фильтры) и [range](#внутрипрофильные-фильтры).
|
Выполняет элемент [execution plan](#execution_plan) `instance` с учетом [instance cutoff](#instance_cutoff) и стандартных фильтров [payload](#внутрипрофильные-фильтры) и [range](#внутрипрофильные-фильтры).
|
||||||
|
При совпадении условий непосредственно перед вызовом выполняет apply_arg_prefix.
|
||||||
Возвращает агрегацию verdict и вердикта `instance`.
|
Возвращает агрегацию verdict и вердикта `instance`.
|
||||||
|
|
||||||
Вариант "preapplied" не выполняет apply_execution_plan, позволяя это сделат вызывающему коду.
|
Вариант "preapplied" не выполняет apply_execution_plan, позволяя это сделат вызывающему коду.
|
||||||
@@ -4658,6 +4660,7 @@ function cond_lua(desync)
|
|||||||
```
|
```
|
||||||
|
|
||||||
Выполняет Lua код из аргумента "cond_code". Код возвращает значение условия через return. Возможна прямая адресация таблицы desync.
|
Выполняет Lua код из аргумента "cond_code". Код возвращает значение условия через return. Возможна прямая адресация таблицы desync.
|
||||||
|
desync.arg передаются с НЕ разименованными `%`, `#`, `\`, поскольку разименование может ссылаться на блобы, создаваемые предыдущими условно вызываемыми инстансами.
|
||||||
|
|
||||||
# Вспомогательные программы
|
# Вспомогательные программы
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -173,7 +173,7 @@ function apply_execution_plan(desync, instance)
|
|||||||
desync.func_n = instance.func_n
|
desync.func_n = instance.func_n
|
||||||
desync.func_instance = instance.func_instance
|
desync.func_instance = instance.func_instance
|
||||||
desync.arg = deepcopy(instance.arg)
|
desync.arg = deepcopy(instance.arg)
|
||||||
apply_arg_prefix(desync)
|
-- no apply_arg_prefix here because it may refer non-existing blobs
|
||||||
end
|
end
|
||||||
-- produce resulting verdict from 2 verdicts
|
-- produce resulting verdict from 2 verdicts
|
||||||
function verdict_aggregate(v1, v2)
|
function verdict_aggregate(v1, v2)
|
||||||
@@ -200,6 +200,8 @@ function plan_instance_execute_preapplied(desync, verdict, instance)
|
|||||||
elseif not pos_check_range(desync, instance.range) then
|
elseif not pos_check_range(desync, instance.range) then
|
||||||
DLOG("plan_instance_execute: not calling '"..desync.func_instance.."' because pos "..pos_str(desync,instance.range.from).." "..pos_str(desync,instance.range.to).." is out of range '"..pos_range_str(instance.range).."'")
|
DLOG("plan_instance_execute: not calling '"..desync.func_instance.."' because pos "..pos_str(desync,instance.range.from).." "..pos_str(desync,instance.range.to).." is out of range '"..pos_range_str(instance.range).."'")
|
||||||
else
|
else
|
||||||
|
-- condition is satisfied. here blobs must be referenced
|
||||||
|
apply_arg_prefix(desync)
|
||||||
DLOG("plan_instance_execute: calling '"..desync.func_instance.."'")
|
DLOG("plan_instance_execute: calling '"..desync.func_instance.."'")
|
||||||
verdict = verdict_aggregate(verdict,_G[instance.func](nil, desync))
|
verdict = verdict_aggregate(verdict,_G[instance.func](nil, desync))
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user