diff options
author | Luca Deri <deri@ntop.org> | 2020-09-24 23:26:03 +0200 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2020-09-24 23:26:03 +0200 |
commit | 044ed14b4f23708ec05f5b5c85ca29acbf4b59db (patch) | |
tree | a03aea7d48eb8ec6b5d83da71c7ab2c40fcbc10c /src/lib/protocols/netflow.c | |
parent | 51e86346d31f270099d4169cd2ebcb0146e5e593 (diff) |
Various optimizations to reduce not-necessary calls
Optimized various UDP dissectors
Removed dead protocols such as pando and pplive
Diffstat (limited to 'src/lib/protocols/netflow.c')
-rw-r--r-- | src/lib/protocols/netflow.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/lib/protocols/netflow.c b/src/lib/protocols/netflow.c index 16c1e0406..ef9125b6e 100644 --- a/src/lib/protocols/netflow.c +++ b/src/lib/protocols/netflow.c @@ -117,19 +117,24 @@ void ndpi_search_netflow(struct ndpi_detection_module_struct *ndpi_struct, struc case 5: case 7: case 9: - if((n == 0) || (n > 30)) + if((n == 0) || (n > 30)) { + NDPI_EXCLUDE_PROTO(ndpi_struct, flow); return; - + } + switch(version) { case 1: expected_len = n * sizeof(struct flow_ver1_rec) + 16 /* header */; break; + case 5: expected_len = n * sizeof(struct flow_ver5_rec) + 24 /* header */; break; + case 7: expected_len = n * sizeof(struct flow_ver7_rec) + 24 /* header */; break; + case 9: /* We need to check the template */ break; @@ -142,16 +147,21 @@ void ndpi_search_netflow(struct ndpi_detection_module_struct *ndpi_struct, struc uptime_offset = 8; break; + case 10: /* IPFIX */ { u_int16_t ipfix_len = n; - if(ipfix_len != payload_len) + if(ipfix_len != payload_len) { + NDPI_EXCLUDE_PROTO(ndpi_struct, flow); return; + } } uptime_offset = 4; break; + default: + NDPI_EXCLUDE_PROTO(ndpi_struct, flow); return; } @@ -167,7 +177,8 @@ void ndpi_search_netflow(struct ndpi_detection_module_struct *ndpi_struct, struc ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_NETFLOW, NDPI_PROTOCOL_UNKNOWN); return; } - } + } else + NDPI_EXCLUDE_PROTO(ndpi_struct, flow); } void init_netflow_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask) |