mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-17 17:31:27 +00:00
IP event protobuf expects ip address to be in the form of bytes. Added the missing conversion. Signed-off-by: Yashvardhan <yashvardhan@netexperience.com>
32 lines
1.0 KiB
Plaintext
32 lines
1.0 KiB
Plaintext
--- a/src/lib/datapipeline/src/dppline.c
|
|
+++ b/src/lib/datapipeline/src/dppline.c
|
|
@@ -2147,9 +2147,10 @@ static void dppline_add_stat_events(Sts_
|
|
ipe->timestamp_ms = cs_rec->ip_event->timestamp;
|
|
|
|
if (cs_rec->ip_event->ip_addr) {
|
|
- ipe->ip_addr.data = malloc(16);
|
|
- memcpy(ipe->ip_addr.data, cs_rec->ip_event->ip_addr,16);
|
|
- ipe->ip_addr.len = 16;
|
|
+ uint8_t ip[4] = {0};
|
|
+ sscanf(cs_rec->ip_event->ip_addr, "%hhu.%hhu.%hhu.%hhu", &ip[0], &ip[1], &ip[2], &ip[3]);
|
|
+ ipe->ip_addr.data = ip;
|
|
+ ipe->ip_addr.len = 4;
|
|
ipe->has_ip_addr = true;
|
|
}
|
|
}
|
|
@@ -2224,10 +2225,10 @@ static void dppline_add_stat_events(Sts_
|
|
}
|
|
|
|
if (cs_rec->connect_event->ip_addr) {
|
|
- coe->ip_addr.data = malloc(16);
|
|
- memcpy(coe->ip_addr.data, cs_rec->connect_event->ip_addr,
|
|
- 16);
|
|
- coe->ip_addr.len = 16;
|
|
+ uint8_t ip[4] = {0};
|
|
+ sscanf(cs_rec->connect_event->ip_addr, "%hhu.%hhu.%hhu.%hhu", &ip[0], &ip[1], &ip[2], &ip[3]);
|
|
+ coe->ip_addr.data = ip;
|
|
+ coe->ip_addr.len = 4;
|
|
coe->has_ip_addr = true;
|
|
}
|
|
|