summaryrefslogtreecommitdiff
path: root/plugin/business/traffic-mirror/src/entry.cpp
diff options
context:
space:
mode:
authorluwenpeng <[email protected]>2024-09-26 14:39:21 +0800
committerluwenpeng <[email protected]>2024-09-26 14:39:21 +0800
commit5d3ee62d23253218243c9be831ffa084add3ef80 (patch)
tree35f051e74d619a831582b4e8f8f131b3b5503c11 /plugin/business/traffic-mirror/src/entry.cpp
parentad96bf00c1e7e123b7c4e513bedabd9850b3a7b7 (diff)
fix compile errors for adapting maat
Diffstat (limited to 'plugin/business/traffic-mirror/src/entry.cpp')
-rw-r--r--plugin/business/traffic-mirror/src/entry.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/plugin/business/traffic-mirror/src/entry.cpp b/plugin/business/traffic-mirror/src/entry.cpp
index 929e50a..c5ff524 100644
--- a/plugin/business/traffic-mirror/src/entry.cpp
+++ b/plugin/business/traffic-mirror/src/entry.cpp
@@ -106,7 +106,7 @@ void policy_table_ex_data_new_cb(const char *table_name, const char *key, const
char *str_json = NULL;
cJSON *json = NULL;
cJSON *object = NULL;
- cjson *subobj = NULL;
+ cJSON *subobj = NULL;
cJSON *item = NULL;
struct policy_table_ex_data *ex_data = NULL;
@@ -132,7 +132,7 @@ void policy_table_ex_data_new_cb(const char *table_name, const char *key, const
}
subobj = cJSON_GetObjectItem(object, "traffic_mirror");
- if (unlikely(!json_subroot))
+ if (unlikely(!subobj))
{
TFE_LOG_ERROR(instance->logger, "invalid format, traffic_mirror is not defined, %s", table_line);
goto error_out;
@@ -142,7 +142,7 @@ void policy_table_ex_data_new_cb(const char *table_name, const char *key, const
ex_data->atomic_refcnt = 1;
ex_data->enable = 0;
ex_data->is_profile_set = 0;
- uuid_parse(key, ex_data->rule_id);
+ uuid_parse(key, ex_data->rule_uuid);
item = cJSON_GetObjectItem(subobj, "enable");
if (unlikely(!item || !cJSON_IsNumber(item)))
@@ -306,24 +306,22 @@ void profile_table_ex_data_new_cb(const char *table_name, const char *key, const
TFE_LOG_DEBUG(instance->logger, "Add traffic mirror profile: %s", key);
- cJSON_Delete(json_root);
+ cJSON_Delete(json);
free(str_json);
return;
error_out:
- if (ex_data)
+ if (json)
{
- profile_table_ex_data_free(ex_data);
+ cJSON_Delete(json);
}
-
if (str_json)
{
free(str_json);
}
-
- if (json_root)
+ if (ex_data)
{
- cJSON_Delete(json_root);
+ profile_table_ex_data_free(ex_data);
}
}
@@ -513,13 +511,13 @@ int traffic_mirror_init(struct tfe_proxy * proxy)
goto errout;
}
- result = maat_plugin_table_ex_schema_register(instance->maat_feather, "PXY_INTERCEPT_COMPILE",
+ result = maat_plugin_table_ex_schema_register(instance->maat_feather, "PXY_INTERCEPT_RULE",
policy_table_ex_data_new_cb, policy_table_ex_data_free_cb, policy_table_ex_data_dup_cb,
0, instance);
if(result < 0)
{
- TFE_LOG_ERROR(instance->logger, "failed at maat_plugin_table_ex_schema_register(PXY_INTERCEPT_COMPILE)");
+ TFE_LOG_ERROR(instance->logger, "failed at maat_plugin_table_ex_schema_register(PXY_INTERCEPT_RULE)");
goto errout;
}
@@ -585,7 +583,7 @@ int traffic_mirror_on_open_cb(const struct tfe_stream * stream, unsigned int thr
}
uuid_unparse(rule_uuid, rule_uuid_str);
- policy_ex_data = (struct policy_table_ex_data *)maat_plugin_table_get_ex_data(instance->maat_feather, PXY_INTERCEPT_COMPILE, rule_uuid, sizeof(uuid_t));
+ policy_ex_data = (struct policy_table_ex_data *)maat_plugin_table_get_ex_data(instance->maat_feather, "PXY_INTERCEPT_RULE", (const char *)&rule_uuid, sizeof(uuid_t));
if (!policy_ex_data || !policy_ex_data->enable)
{
goto detach;
@@ -612,7 +610,7 @@ int traffic_mirror_on_open_cb(const struct tfe_stream * stream, unsigned int thr
if (policy_ex_data->is_profile_set)
{
uuid_unparse(policy_ex_data->profile_uuid, profile_uuid_str);
- profile_ex_data = (struct profile_table_ex_data *)maat_plugin_table_get_ex_data(instance->maat_feather, TSG_PROFILE_TRAFFIC_MIRROR, policy_ex_data->profile_uuid, sizeof(uuid_t));
+ profile_ex_data = (struct profile_table_ex_data *)maat_plugin_table_get_ex_data(instance->maat_feather, "TSG_PROFILE_TRAFFIC_MIRROR", (const char *)&policy_ex_data->profile_uuid, sizeof(uuid_t));
if (!profile_ex_data)
{
TFE_LOG_ERROR(instance->logger, "failed at getting policy %s's profile, profile id = %s, "
@@ -647,8 +645,8 @@ int traffic_mirror_on_open_cb(const struct tfe_stream * stream, unsigned int thr
rebuild_target = NULL;
traffic_mirror_rebuild_handshake(me->rebuild_ctx, thread_id);
- TFE_LOG_DEBUG(instance->logger, "hit traffic mirror policy %s, profile %s, vlan %d",
- rule_uuid_str, profile_uuid_str, me->rebuild_ctx->target.vlan_tci);
+ TFE_LOG_DEBUG(instance->logger, "hit traffic mirror policy %s, profile %s",
+ rule_uuid_str, profile_uuid_str);
return ACTION_FORWARD_DATA;
detach: