aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2022-09-05 13:59:51 +0200
committerGitHub <noreply@github.com>2022-09-05 13:59:51 +0200
commit0a47f745cc87f967f0d8513b4178321e21a02efc (patch)
treebfa7610e8c35281d8c94d35aacd1f67908355721 /example
parent01028ee77921cb21dee8b0e5f1f912ffd304244a (diff)
Avoid useless host automa lookup (#1724)
The host automa is used for two tasks: * protocol sub-classification (obviously); * DGA evaluation: the idea is that if a domain is present in this automa, it can't be a DGA, regardless of its format/name. In most dissectors both checks are executed, i.e. the code is something like: ``` ndpi_match_host_subprotocol(..., flow->host_server_name, ...); ndpi_check_dga_name(..., flow->host_server_name,...); ``` In that common case, we can perform only one automa lookup: if we check the sub-classification before the DGA, we can avoid the second lookup in the DGA function itself.
Diffstat (limited to 'example')
-rw-r--r--example/ndpiReader.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index 68151c939..cd8a48f66 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -4330,12 +4330,12 @@ static void dgaUnitTest() {
for(i=0; non_dga[i] != NULL; i++) {
if(debug) printf("Checking non DGA %s\n", non_dga[i]);
- assert(ndpi_check_dga_name(ndpi_str, NULL, (char*)non_dga[i], 1) == 0);
+ assert(ndpi_check_dga_name(ndpi_str, NULL, (char*)non_dga[i], 1, 1) == 0);
}
for(i=0; dga[i] != NULL; i++) {
if(debug) printf("Checking DGA %s\n", non_dga[i]);
- assert(ndpi_check_dga_name(ndpi_str, NULL, (char*)dga[i], 1) == 1);
+ assert(ndpi_check_dga_name(ndpi_str, NULL, (char*)dga[i], 1, 1) == 1);
}
ndpi_exit_detection_module(ndpi_str);