diff options
author | Luca Deri <deri@ntop.org> | 2023-06-09 19:50:47 +0200 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2023-06-09 19:50:47 +0200 |
commit | 63a2b359b9bbc481ef266407791f09fd12be8fc4 (patch) | |
tree | 9c6e7a55d04bcd6b3eae731df1b9f2888180dedc | |
parent | 7150b40c63e7393cddd94d40a2a4d0dd70f80cbc (diff) |
Added vlan_id in ndpi_flow2json() prototype
-rw-r--r-- | example/reader_util.c | 1 | ||||
-rw-r--r-- | src/include/ndpi_api.h | 1 | ||||
-rw-r--r-- | src/lib/ndpi_utils.c | 2 |
3 files changed, 4 insertions, 0 deletions
diff --git a/example/reader_util.c b/example/reader_util.c index 1ede37ca2..a35eaf3c5 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -1392,6 +1392,7 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl { if (ndpi_flow2json(workflow->ndpi_struct, flow->ndpi_flow, flow->ip_version, flow->protocol, + flow->vlan_id, flow->src_ip, flow->dst_ip, &flow->src_ip6, &flow->dst_ip6, flow->src_port, flow->dst_port, diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h index c7912ef1d..b378dfb58 100644 --- a/src/include/ndpi_api.h +++ b/src/include/ndpi_api.h @@ -1127,6 +1127,7 @@ extern "C" { struct ndpi_flow_struct *flow, u_int8_t ip_version, u_int8_t l4_protocol, + u_int16_t vlan_id, u_int32_t src_v4, u_int32_t dst_v4, struct ndpi_in6_addr *src_v6, struct ndpi_in6_addr *dst_v6, u_int16_t src_port, u_int16_t dst_port, diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c index 0199d6424..10328380c 100644 --- a/src/lib/ndpi_utils.c +++ b/src/lib/ndpi_utils.c @@ -1589,6 +1589,7 @@ int ndpi_flow2json(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, u_int8_t ip_version, u_int8_t l4_protocol, + u_int16_t vlan_id, u_int32_t src_v4, u_int32_t dst_v4, struct ndpi_in6_addr *src_v6, struct ndpi_in6_addr *dst_v6, u_int16_t src_port, u_int16_t dst_port, @@ -1607,6 +1608,7 @@ int ndpi_flow2json(struct ndpi_detection_module_struct *ndpi_struct, ndpi_patchIPv6Address(src_name), ndpi_patchIPv6Address(dst_name); } + if(vlan_id != 0) ndpi_serialize_string_uint32(serializer, "vlan_id", vlan_id); ndpi_serialize_string_string(serializer, "src_ip", src_name); ndpi_serialize_string_string(serializer, "dest_ip", dst_name); if(src_port) ndpi_serialize_string_uint32(serializer, "src_port", ntohs(src_port)); |