Add support for flow client/server information (#1671)
In a lot of places in ndPI we use *packet* source/dest info (address/port/direction) when we are interested in *flow* client/server info, instead. Add basic logic to autodetect this kind of information. nDPI doesn't perform any "flow management" itself but this task is delegated to the external application. It is then likely that the application might provide more reliable hints about flow client/server direction and about the TCP handshake presence: in that case, these information might be (optionally) passed to the library, disabling the internal "autodetect" logic. These new fields have been used in some LRU caches and in the "guessing" algorithm. It is quite likely that some other code needs to be updated.
This commit is contained in:
@@ -232,7 +232,7 @@ static void ndpi_check_ftp_data(struct ndpi_detection_module_struct *ndpi_struct
|
||||
Make sure we see the beginning of the connection as otherwise we might have
|
||||
false positive results
|
||||
*/
|
||||
if(flow->l4.tcp.seen_syn) {
|
||||
if(ndpi_seen_flow_beginning(flow)) {
|
||||
if((packet->payload_packet_len > 0)
|
||||
&& (ndpi_match_file_header(ndpi_struct, flow)
|
||||
|| ndpi_match_ftp_data_directory(ndpi_struct, flow)
|
||||
|
||||
Reference in New Issue
Block a user