aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2019-10-17 00:38:42 +0200
committerLuca Deri <deri@ntop.org>2019-10-17 00:38:42 +0200
commit8b157bb13ffbc52aaeebef7931eabf2e7dc80e85 (patch)
tree1b008825214c3c01335d054b5a3f735f4a99ac61
parenta8c71dcd207856f5ef5a9eb5acec424711395aa6 (diff)
Ports are not JSON printed when 0 (e.g. with ICMP)
-rw-r--r--src/lib/ndpi_utils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c
index b394bf500..bda7f15ad 100644
--- a/src/lib/ndpi_utils.c
+++ b/src/lib/ndpi_utils.c
@@ -782,8 +782,8 @@ int ndpi_flow2json(struct ndpi_detection_module_struct *ndpi_struct,
ndpi_serialize_string_string(serializer, "src_ip", src_name);
ndpi_serialize_string_string(serializer, "dest_ip", dst_name);
- ndpi_serialize_string_uint32(serializer, "src_port", src_port);
- ndpi_serialize_string_uint32(serializer, "dst_port", dst_port);
+ if(src_port) ndpi_serialize_string_uint32(serializer, "src_port", src_port);
+ if(dst_port) ndpi_serialize_string_uint32(serializer, "dst_port", dst_port);
switch(l4_protocol) {
case IPPROTO_TCP: