aboutsummaryrefslogtreecommitdiff
path: root/src/lib/protocols/modbus.c
diff options
context:
space:
mode:
authorVladimir Gavrilov <105977161+0xA50C1A1@users.noreply.github.com>2023-11-28 20:03:00 +0300
committerGitHub <noreply@github.com>2023-11-28 18:03:00 +0100
commitc60c03766c937cecc4bee4b98c2e511b2057fd14 (patch)
tree859438e375dcb36b8c49da51b642885eb8d329e5 /src/lib/protocols/modbus.c
parent688a197b85545b056e3afa8338719154ebc865c7 (diff)
Add Schneider Electric’s UMAS detection support (#2180)
* Add Schneider Electric’s UMAS detection support * Swap proto IDs in ndpi_set_detected_protocol * Update unit test result
Diffstat (limited to 'src/lib/protocols/modbus.c')
-rw-r--r--src/lib/protocols/modbus.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/lib/protocols/modbus.c b/src/lib/protocols/modbus.c
index 8eb0f8dae..e57b0d69e 100644
--- a/src/lib/protocols/modbus.c
+++ b/src/lib/protocols/modbus.c
@@ -47,9 +47,16 @@ static void ndpi_search_modbus_tcp(struct ndpi_detection_module_struct *ndpi_str
// the fourth parameter of the payload is the length of the segment
if((modbus_len-1) == (packet->payload_packet_len - 7 /* ModbusTCP header len */)) {
- NDPI_LOG_INFO(ndpi_struct, "found MODBUS\n");
- ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MODBUS, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI);
- return;
+ /* Check Modbus function code. 0x5A (90) is reserved for UMAS protocol */
+ if (packet->payload[7] == 0x5A) {
+ NDPI_LOG_INFO(ndpi_struct, "found Schneider Electric UMAS\n");
+ ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_UMAS, NDPI_PROTOCOL_MODBUS, NDPI_CONFIDENCE_DPI);
+ return;
+ }
+
+ NDPI_LOG_INFO(ndpi_struct, "found MODBUS\n");
+ ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MODBUS, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI);
+ return;
}
}
}