summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author童宗振 <[email protected]>2024-05-13 06:07:37 +0000
committer童宗振 <[email protected]>2024-05-13 06:07:37 +0000
commite8f6731f9e8dd0ac168d711829e841f5ad0016fe (patch)
tree380b47b11b0387cbc655db417b7ac578ce9c8b1e
parent601248da31d00f5d04055e64393b5ff5c55388ac (diff)
parent682bae1b7e96a0c4fc287a02b8d9bbeb1d044c30 (diff)
Merge branch 'fix_device_group_error' into 'master'v0.1.9-20240513
(TSG-21191)Fix device group error See merge request tsg/dp_telemetry_app!33
-rw-r--r--src/maat.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/maat.c b/src/maat.c
index 4fc741e..90951aa 100644
--- a/src/maat.c
+++ b/src/maat.c
@@ -104,7 +104,7 @@ bool maat_rule_parse(const char * table_line, struct dp_trace_telemetry_desc * t
unsigned int sampling = 0;
unsigned int snaplen = 0;
unsigned int with_packet_capture = 0;
- char device_group[1024] = "";
+ char device_group[4096] = "";
char traffic_link_id[128] = "";
unsigned int is_valid = 1;
@@ -113,7 +113,7 @@ bool maat_rule_parse(const char * table_line, struct dp_trace_telemetry_desc * t
int ret = 0;
dzlog_info("telemetry add maat parse config rule:%s", table_line);
- ret = sscanf(table_line, "%s\t%u\t%127s\t%u\t%u\t%u\t%u\t%1023s\t%127s\t%u", uuid, &pkt_cnt_max, bpf_expr, &timeout,
+ ret = sscanf(table_line, "%s\t%u\t%127s\t%u\t%u\t%u\t%u\t%4095s\t%127s\t%u", uuid, &pkt_cnt_max, bpf_expr, &timeout,
&sampling, &snaplen, &with_packet_capture, device_group, traffic_link_id, &is_valid);
if (ret != 10)
{
@@ -122,11 +122,18 @@ bool maat_rule_parse(const char * table_line, struct dp_trace_telemetry_desc * t
}
bool device_group_match = false;
+ if (strcasecmp(device_group, "{}") == 0)
+ {
+ dzlog_info("When device_group is empty, all devices are matched");
+ device_group_match = true;
+ goto device_group_match_end;
+ }
+
device_group_json = cJSON_Parse(device_group);
if (device_group_json == NULL)
{
dzlog_error("parse to json failed:%s", device_group);
- goto end;
+ goto device_group_match_end;
}
cJSON * tag_sets_item = cJSON_GetObjectItem(device_group_json, "tag_sets");