From 8b157bb13ffbc52aaeebef7931eabf2e7dc80e85 Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Thu, 17 Oct 2019 00:38:42 +0200 Subject: Ports are not JSON printed when 0 (e.g. with ICMP) --- src/lib/ndpi_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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: -- cgit v1.2.3