aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2022-06-30 13:36:20 +0200
committerToni Uhlig <matzeton@googlemail.com>2022-06-30 13:36:20 +0200
commiteec5bccabd76162e53ec7b37a1e7dd3309c24f3e (patch)
treeabca9db0570cdf0ea8a7e60ccede3f78b5970f07 /example
parentc96f4512fa4bbc0266c1bba43812f76361190699 (diff)
Fix byte-order issue during ndpiReader tcp/udp src/dst port serialization. Fixes #1608.fix/ndpi-reader-serialization-issues
* fixed possible memory leak caused by an invalid call to `node_proto_guess_walker()` during serialization * execute serialization code while running regression tests Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'example')
-rw-r--r--example/ndpiReader.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index 9fa63c8bf..d7d720fff 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -1624,8 +1624,8 @@ static void printFlowSerialized(u_int16_t thread_id,
ndpi_serialize_string_float(serializer, "duration_ms", (l-f)/1000.0, "%.3f");
ndpi_serialize_string_string(serializer, "src_name", flow->src_name);
ndpi_serialize_string_string(serializer, "dst_name", flow->dst_name);
- ndpi_serialize_string_uint32(serializer, "src_port", flow->src_port);
- ndpi_serialize_string_uint32(serializer, "dst_port", flow->dst_port);
+ ndpi_serialize_string_uint32(serializer, "src_port", ntohs(flow->src_port));
+ ndpi_serialize_string_uint32(serializer, "dst_port", ntohs(flow->dst_port));
ndpi_serialize_string_uint32(serializer, "ip_version", flow->ip_version);
ndpi_serialize_string_uint32(serializer, "vlan_id", flow->vlan_id);
ndpi_serialize_string_uint32(serializer, "bidirectional", flow->bidirectional);
@@ -3406,8 +3406,6 @@ static void printFlowsStats() {
ndpi_twalk(ndpi_thread_info[thread_id].workflow->ndpi_flows_root[i],
node_print_known_proto_walker, &thread_id);
ndpi_twalk(ndpi_thread_info[thread_id].workflow->ndpi_flows_root[i],
- node_proto_guess_walker, &thread_id);
- ndpi_twalk(ndpi_thread_info[thread_id].workflow->ndpi_flows_root[i],
node_print_unknown_proto_walker, &thread_id);
}
}