summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-11-27 19:37:03 +0800
committeryangwei <[email protected]>2024-11-27 19:37:03 +0800
commit3202b9ae3107564824b87e89f43d56e525c39a57 (patch)
tree145e82141c93257bc861f6a8a4098eba3b870117
parent10dc717b073b4532238357eb646aed5a5c531a88 (diff)
🐞 fix(fix module_get_by_name bug): continue find when mod null
-rw-r--r--infra/module_manager/module_manager.c2
-rw-r--r--test/lpi_plus/test_expect/dns_pcap.json4
-rw-r--r--test/lpi_plus/test_expect/mixed_pcap.json26
-rw-r--r--test/lpi_plus/test_expect/socks_pcap.json62
4 files changed, 47 insertions, 47 deletions
diff --git a/infra/module_manager/module_manager.c b/infra/module_manager/module_manager.c
index a8a3233..3765c7b 100644
--- a/infra/module_manager/module_manager.c
+++ b/infra/module_manager/module_manager.c
@@ -226,7 +226,7 @@ struct module *module_manager_get_module(struct module_manager *mod_mgr, const c
{
for(int i=0; i<mod_mgr->n_descriptor; i++)
{
- if(mod_mgr->descriptors[i].mod == NULL)break;
+ if(mod_mgr->descriptors[i].mod == NULL)continue;
if(strcmp(mod_mgr->descriptors[i].mod->name, module_name)==0 && mod_mgr->descriptors[i].initialized)
{
return mod_mgr->descriptors[i].mod;
diff --git a/test/lpi_plus/test_expect/dns_pcap.json b/test/lpi_plus/test_expect/dns_pcap.json
index 79daba3..1aeea46 100644
--- a/test/lpi_plus/test_expect/dns_pcap.json
+++ b/test/lpi_plus/test_expect/dns_pcap.json
@@ -27,14 +27,14 @@
"STREAM_DIR": "C2S",
"name": "APP_PROTO_IDENTIFY_RESULT_4"
}, {
- "Tuple4": "124.88.175.201:18091-8.8.8.8:53-6-0",
+ "Tuple4": "124.88.175.201:18088-8.8.8.8:53-6-0",
"STREAM_TYPE": "TCP",
"l7_label_id": [32],
"l7_label_name": ["DNS"],
"STREAM_DIR": "C2S",
"name": "APP_PROTO_IDENTIFY_RESULT_5"
}, {
- "Tuple4": "124.88.175.201:18088-8.8.8.8:53-6-0",
+ "Tuple4": "124.88.175.201:18091-8.8.8.8:53-6-0",
"STREAM_TYPE": "TCP",
"l7_label_id": [32],
"l7_label_name": ["DNS"],
diff --git a/test/lpi_plus/test_expect/mixed_pcap.json b/test/lpi_plus/test_expect/mixed_pcap.json
index 3decb52..4b8d1f6 100644
--- a/test/lpi_plus/test_expect/mixed_pcap.json
+++ b/test/lpi_plus/test_expect/mixed_pcap.json
@@ -34,60 +34,60 @@
"STREAM_DIR": "DOUBLE",
"name": "APP_PROTO_IDENTIFY_RESULT_5"
}, {
- "Tuple4": "117.145.115.74:37855-218.31.124.234:21121-6-0",
- "STREAM_TYPE": "TCP",
- "l7_label_id": [45],
- "l7_label_name": ["FTP"],
- "STREAM_DIR": "DOUBLE",
- "name": "APP_PROTO_IDENTIFY_RESULT_6"
- }, {
"Tuple4": "196.188.12.179:54776-192.185.31.244:110-6-0",
"STREAM_TYPE": "TCP",
"l7_label_id": [147],
"l7_label_name": ["POP3"],
"STREAM_DIR": "C2S",
- "name": "APP_PROTO_IDENTIFY_RESULT_7"
+ "name": "APP_PROTO_IDENTIFY_RESULT_6"
}, {
"Tuple4": "196.189.57.105:14636-68.232.159.216:25-6-0",
"STREAM_TYPE": "TCP",
"l7_label_id": [186],
"l7_label_name": ["SMTP"],
"STREAM_DIR": "C2S",
- "name": "APP_PROTO_IDENTIFY_RESULT_8"
+ "name": "APP_PROTO_IDENTIFY_RESULT_7"
}, {
"Tuple4": "196.190.160.6:20997-64.225.54.152:25-6-0",
"STREAM_TYPE": "TCP",
"l7_label_id": [186],
"l7_label_name": ["SMTP"],
"STREAM_DIR": "C2S",
- "name": "APP_PROTO_IDENTIFY_RESULT_9"
+ "name": "APP_PROTO_IDENTIFY_RESULT_8"
}, {
"Tuple4": "196.188.3.8:50020-82.98.178.159:110-6-0",
"STREAM_TYPE": "TCP",
"l7_label_id": [147],
"l7_label_name": ["POP3"],
"STREAM_DIR": "C2S",
- "name": "APP_PROTO_IDENTIFY_RESULT_10"
+ "name": "APP_PROTO_IDENTIFY_RESULT_9"
}, {
"Tuple4": "196.189.45.189:1440-40.101.92.178:587-6-0",
"STREAM_TYPE": "TCP",
"l7_label_id": [186],
"l7_label_name": ["SMTP"],
"STREAM_DIR": "C2S",
- "name": "APP_PROTO_IDENTIFY_RESULT_11"
+ "name": "APP_PROTO_IDENTIFY_RESULT_10"
}, {
"Tuple4": "196.191.120.240:37943-81.19.77.166:587-6-0",
"STREAM_TYPE": "TCP",
"l7_label_id": [186],
"l7_label_name": ["SMTP"],
"STREAM_DIR": "C2S",
- "name": "APP_PROTO_IDENTIFY_RESULT_12"
+ "name": "APP_PROTO_IDENTIFY_RESULT_11"
}, {
"Tuple4": "39.144.206.199:22005-117.156.19.31:8000-17-0",
"STREAM_TYPE": "UDP",
"l7_label_id": [201, 174, 175],
"l7_label_name": ["STUN", "RTCP", "RTP"],
"STREAM_DIR": "S2C",
+ "name": "APP_PROTO_IDENTIFY_RESULT_12"
+ }, {
+ "Tuple4": "117.145.115.74:37855-218.31.124.234:21121-6-0",
+ "STREAM_TYPE": "TCP",
+ "l7_label_id": [45],
+ "l7_label_name": ["FTP"],
+ "STREAM_DIR": "S2C",
"name": "APP_PROTO_IDENTIFY_RESULT_13"
}, {
"Tuple4": "85.117.117.169:47762-173.194.73.95:443-17-0",
diff --git a/test/lpi_plus/test_expect/socks_pcap.json b/test/lpi_plus/test_expect/socks_pcap.json
index 354e426..67b12ec 100644
--- a/test/lpi_plus/test_expect/socks_pcap.json
+++ b/test/lpi_plus/test_expect/socks_pcap.json
@@ -111,143 +111,143 @@
"STREAM_DIR": "DOUBLE",
"name": "APP_PROTO_IDENTIFY_RESULT_16"
}, {
- "Tuple4": "192.168.122.100:62395-192.168.122.202:1080-6-0",
- "STREAM_TYPE": "TCP",
- "l7_label_id": [8005, 45],
- "l7_label_name": ["SOCKS", "FTP"],
- "STREAM_DIR": "DOUBLE",
- "name": "APP_PROTO_IDENTIFY_RESULT_17"
- }, {
- "Tuple4": "192.168.122.100:50259-192.168.122.202:1080-6-0",
- "STREAM_TYPE": "TCP",
- "l7_label_id": [8005, 67],
- "l7_label_name": ["SOCKS", "HTTP"],
- "STREAM_DIR": "DOUBLE",
- "name": "APP_PROTO_IDENTIFY_RESULT_18"
- }, {
"Tuple4": "10.0.0.1:1637-10.0.0.2:21477-6-0",
"STREAM_TYPE": "TCP",
"l7_label_id": [8005, 67],
"l7_label_name": ["SOCKS", "HTTP"],
"STREAM_DIR": "DOUBLE",
- "name": "APP_PROTO_IDENTIFY_RESULT_19"
+ "name": "APP_PROTO_IDENTIFY_RESULT_17"
}, {
"Tuple4": "10.0.0.1:54263-10.0.0.2:8855-6-0",
"STREAM_TYPE": "TCP",
"l7_label_id": [67],
"l7_label_name": ["HTTP"],
"STREAM_DIR": "DOUBLE",
- "name": "APP_PROTO_IDENTIFY_RESULT_20"
+ "name": "APP_PROTO_IDENTIFY_RESULT_18"
}, {
"Tuple4": "10.0.0.2:53709-10.0.0.1:1080-6-0",
"STREAM_TYPE": "TCP",
"l7_label_id": [186],
"l7_label_name": ["SMTP"],
"STREAM_DIR": "DOUBLE",
- "name": "APP_PROTO_IDENTIFY_RESULT_21"
+ "name": "APP_PROTO_IDENTIFY_RESULT_19"
}, {
"Tuple4": "10.180.156.185:54068-10.180.156.249:1080-6-0",
"STREAM_TYPE": "TCP",
"l7_label_id": [8005],
"l7_label_name": ["SOCKS"],
"STREAM_DIR": "DOUBLE",
- "name": "APP_PROTO_IDENTIFY_RESULT_22"
+ "name": "APP_PROTO_IDENTIFY_RESULT_20"
}, {
"Tuple4": "10.180.156.185:54069-10.180.156.249:1080-6-0",
"STREAM_TYPE": "TCP",
"l7_label_id": [8005],
"l7_label_name": ["SOCKS"],
"STREAM_DIR": "DOUBLE",
- "name": "APP_PROTO_IDENTIFY_RESULT_23"
+ "name": "APP_PROTO_IDENTIFY_RESULT_21"
}, {
"Tuple4": "10.180.156.185:54072-10.180.156.249:1080-6-0",
"STREAM_TYPE": "TCP",
"l7_label_id": [8005, 67],
"l7_label_name": ["SOCKS", "HTTP"],
"STREAM_DIR": "DOUBLE",
- "name": "APP_PROTO_IDENTIFY_RESULT_24"
+ "name": "APP_PROTO_IDENTIFY_RESULT_22"
}, {
"Tuple4": "10.180.156.185:53554-10.180.156.249:1080-6-0",
"STREAM_TYPE": "TCP",
"l7_label_id": [8005, 199],
"l7_label_name": ["SOCKS", "SSL"],
"STREAM_DIR": "DOUBLE",
- "name": "APP_PROTO_IDENTIFY_RESULT_25"
+ "name": "APP_PROTO_IDENTIFY_RESULT_23"
}, {
"Tuple4": "10.180.156.185:53555-10.180.156.249:1080-6-0",
"STREAM_TYPE": "TCP",
"l7_label_id": [8005, 199],
"l7_label_name": ["SOCKS", "SSL"],
"STREAM_DIR": "DOUBLE",
- "name": "APP_PROTO_IDENTIFY_RESULT_26"
+ "name": "APP_PROTO_IDENTIFY_RESULT_24"
}, {
"Tuple4": "10.180.156.185:53556-10.180.156.249:1080-6-0",
"STREAM_TYPE": "TCP",
"l7_label_id": [8005, 199],
"l7_label_name": ["SOCKS", "SSL"],
"STREAM_DIR": "DOUBLE",
- "name": "APP_PROTO_IDENTIFY_RESULT_27"
+ "name": "APP_PROTO_IDENTIFY_RESULT_25"
}, {
"Tuple4": "192.168.122.100:58811-8.8.8.8:53-17-0",
"STREAM_TYPE": "UDP",
"l7_label_id": [32],
"l7_label_name": ["DNS"],
"STREAM_DIR": "DOUBLE",
- "name": "APP_PROTO_IDENTIFY_RESULT_28"
+ "name": "APP_PROTO_IDENTIFY_RESULT_26"
}, {
"Tuple4": "ff02::1:2:547-fe80::424:6d4c:9a85:337d:546-17-0",
"STREAM_TYPE": "UDP",
"l7_label_id": [29],
"l7_label_name": ["DHCP"],
"STREAM_DIR": "S2C",
- "name": "APP_PROTO_IDENTIFY_RESULT_29"
+ "name": "APP_PROTO_IDENTIFY_RESULT_27"
}, {
"Tuple4": "192.168.122.100:58117-8.8.8.8:53-17-0",
"STREAM_TYPE": "UDP",
"l7_label_id": [32],
"l7_label_name": ["DNS"],
"STREAM_DIR": "DOUBLE",
- "name": "APP_PROTO_IDENTIFY_RESULT_30"
+ "name": "APP_PROTO_IDENTIFY_RESULT_28"
}, {
"Tuple4": "192.168.122.100:50258-184.50.87.123:80-6-0",
"STREAM_TYPE": "TCP",
"l7_label_id": [67],
"l7_label_name": ["HTTP"],
"STREAM_DIR": "DOUBLE",
- "name": "APP_PROTO_IDENTIFY_RESULT_31"
+ "name": "APP_PROTO_IDENTIFY_RESULT_29"
}, {
"Tuple4": "192.168.122.100:52837-8.8.8.8:53-17-0",
"STREAM_TYPE": "UDP",
"l7_label_id": [32],
"l7_label_name": ["DNS"],
"STREAM_DIR": "DOUBLE",
- "name": "APP_PROTO_IDENTIFY_RESULT_32"
+ "name": "APP_PROTO_IDENTIFY_RESULT_30"
}, {
"Tuple4": "192.168.122.100:50262-74.125.235.196:443-6-0",
"STREAM_TYPE": "TCP",
"l7_label_id": "UNKNOWN",
"STREAM_DIR": "C2S",
- "name": "APP_PROTO_IDENTIFY_RESULT_33"
+ "name": "APP_PROTO_IDENTIFY_RESULT_31"
}, {
"Tuple4": "192.168.122.100:57617-8.8.8.8:53-17-0",
"STREAM_TYPE": "UDP",
"l7_label_id": [32],
"l7_label_name": ["DNS"],
"STREAM_DIR": "DOUBLE",
- "name": "APP_PROTO_IDENTIFY_RESULT_34"
+ "name": "APP_PROTO_IDENTIFY_RESULT_32"
}, {
"Tuple4": "192.168.122.100:138-192.168.122.255:138-17-0",
"STREAM_TYPE": "UDP",
"l7_label_id": [129],
"l7_label_name": ["NETBIOS"],
"STREAM_DIR": "C2S",
- "name": "APP_PROTO_IDENTIFY_RESULT_35"
+ "name": "APP_PROTO_IDENTIFY_RESULT_33"
+ }, {
+ "Tuple4": "192.168.122.100:62395-192.168.122.202:1080-6-0",
+ "STREAM_TYPE": "TCP",
+ "l7_label_id": [8005, 45],
+ "l7_label_name": ["SOCKS", "FTP"],
+ "STREAM_DIR": "C2S",
+ "name": "APP_PROTO_IDENTIFY_RESULT_34"
}, {
"Tuple4": "192.168.122.100:137-192.168.122.255:137-17-0",
"STREAM_TYPE": "UDP",
"l7_label_id": [129],
"l7_label_name": ["NETBIOS"],
"STREAM_DIR": "C2S",
+ "name": "APP_PROTO_IDENTIFY_RESULT_35"
+ }, {
+ "Tuple4": "192.168.122.100:50259-192.168.122.202:1080-6-0",
+ "STREAM_TYPE": "TCP",
+ "l7_label_id": [8005, 67],
+ "l7_label_name": ["SOCKS", "HTTP"],
+ "STREAM_DIR": "C2S",
"name": "APP_PROTO_IDENTIFY_RESULT_36"
}, {
"Tuple4": "10.0.0.1:50606-10.0.0.2:9901-6-0",