Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Json export of source and destination port aren't exported in host byte order  #1608

@gpfgen

Description

@gpfgen

Exporting the flows in Json after running nDPI gives wrong source + destination ports.
The function (line 1606 in example/ndpiReader.c):

static void printFlowSerialized(u_int16_t thread_id, struct ndpi_flow_info *flow) {
..
ndpi_serialize_string_uint32(serializer, "src_port", flow->src_port);
ndpi_serialize_string_uint32(serializer, "dst_port", flow->dst_port);
..
}

should be:

static void printFlowSerialized(u_int16_t thread_id, struct ndpi_flow_info *flow) {
..
ndpi_serialize_string_uint32(serializer, "src_port", ntohs(flow->src_port));
ndpi_serialize_string_uint32(serializer, "dst_port", ntohs(flow->dst_port));
..
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions