TSG-12300 代理日志增加Traffic Vsys id字段

This commit is contained in:
fengweihao
2022-10-26 14:30:45 +08:00
committed by 卢文朋
parent 87adce7cbf
commit 6e4fc2a978
9 changed files with 66 additions and 9 deletions

View File

@@ -57,6 +57,8 @@ enum manipulate_action
MA_ACTION_INSERT,
MA_ACTION_ELEMENT,
MA_ACTION_LUA_SCRIPT,
MA_ACTION_ALLOW,
MA_ACTION_MONITOR,
__MA_ACTION_MAX
};
@@ -125,6 +127,7 @@ struct policy_action_param
char *position;
float enforcement_ratio;
int vsys_id;
int profile_id;
int status_code;
@@ -326,6 +329,8 @@ static enum manipulate_action manipulate_action_str2idx(const char *action_str)
clue_action_map[MA_ACTION_INSERT]= "insert";
clue_action_map[MA_ACTION_ELEMENT] = "edit_element";
clue_action_map[MA_ACTION_LUA_SCRIPT] = "run_script";
clue_action_map[MA_ACTION_ALLOW] = "allow";
clue_action_map[MA_ACTION_MONITOR] = "monitor";
size_t i = 0;
@@ -419,7 +424,20 @@ void policy_action_param_new(int idx, const struct Maat_rule_t* rule, const char
switch(param->action)
{
case MA_ACTION_ALLOW:
case MA_ACTION_MONITOR:
item=cJSON_GetObjectItem(json,"vsys_id");
if(item && item->type==cJSON_Number)
{
param->vsys_id= item->valueint;
}
break;
case MA_ACTION_REDIRECT:
item=cJSON_GetObjectItem(json,"vsys_id");
if(item && item->type==cJSON_Number)
{
param->vsys_id= item->valueint;
}
item=cJSON_GetObjectItem(json,"code");
if(item && item->type==cJSON_Number)
{
@@ -441,6 +459,11 @@ void policy_action_param_new(int idx, const struct Maat_rule_t* rule, const char
}
break;
case MA_ACTION_BLOCK:
item=cJSON_GetObjectItem(json,"vsys_id");
if(item && item->type==cJSON_Number)
{
param->vsys_id= item->valueint;
}
item=cJSON_GetObjectItem(json,"code");
if(item && item->type==cJSON_Number)
{
@@ -458,6 +481,11 @@ void policy_action_param_new(int idx, const struct Maat_rule_t* rule, const char
}
break;
case MA_ACTION_REPLACE:
item=cJSON_GetObjectItem(json,"vsys_id");
if(item && item->type==cJSON_Number)
{
param->vsys_id= item->valueint;
}
item=cJSON_GetObjectItem(json,"enforcement_ratio");
if(item && item->type==cJSON_Number)
{
@@ -493,6 +521,11 @@ void policy_action_param_new(int idx, const struct Maat_rule_t* rule, const char
param->n_rule = rule_id;
break;
case MA_ACTION_HIJACK:
item=cJSON_GetObjectItem(json,"vsys_id");
if(item && item->type==cJSON_Number)
{
param->vsys_id= item->valueint;
}
item=cJSON_GetObjectItem(json,"hijack_profile");
if(item && item->type==cJSON_Number){
param->profile_id = item->valueint;
@@ -508,6 +541,11 @@ void policy_action_param_new(int idx, const struct Maat_rule_t* rule, const char
}
break;
case MA_ACTION_INSERT:
item=cJSON_GetObjectItem(json,"vsys_id");
if(item && item->type==cJSON_Number)
{
param->vsys_id= item->valueint;
}
item=cJSON_GetObjectItem(json,"insert_profile");
if(item && item->type==cJSON_Number){
param->profile_id = item->valueint;
@@ -527,6 +565,11 @@ void policy_action_param_new(int idx, const struct Maat_rule_t* rule, const char
}
break;
case MA_ACTION_ELEMENT:
item=cJSON_GetObjectItem(json,"vsys_id");
if(item && item->type==cJSON_Number)
{
param->vsys_id= item->valueint;
}
rules = cJSON_GetObjectItem(json, "rules");
if(rules == NULL)
{
@@ -565,6 +608,11 @@ void policy_action_param_new(int idx, const struct Maat_rule_t* rule, const char
param->e_rule = rule_id;
break;
case MA_ACTION_LUA_SCRIPT:
item=cJSON_GetObjectItem(json,"vsys_id");
if(item && item->type==cJSON_Number)
{
param->vsys_id= item->valueint;
}
item=cJSON_GetObjectItem(json,"run_script_profile");
if(item && item->type==cJSON_Number){
param->profile_id = item->valueint;
@@ -3114,7 +3162,7 @@ void proxy_on_http_end(const struct tfe_stream * stream,
struct proxy_log log_msg = {.stream=stream, .http=session, .result=ctx->enforce_rules, .result_num=ctx->n_enforce,
.req_body=ctx->log_req_body, .resp_body=ctx->log_resp_body, .action=0, .inject_sz=ctx->inject_sz,
.asn_client=ctx->ip_ctx.asn_client, .asn_server=ctx->ip_ctx.asn_server, .location_client=ctx->ip_ctx.location_client,
.location_server=ctx->ip_ctx.location_server};
.location_server=ctx->ip_ctx.location_server, .vsys_id=ctx->param->vsys_id};
if(ctx->action == PX_ACTION_MANIPULATE)
{