Code cleanup (removed redundancy)

This commit is contained in:
Luca Deri
2022-04-22 19:03:50 +02:00
parent d5ae9170ba
commit 9d31b7450b
+6 -8
View File
@@ -3301,6 +3301,7 @@ int ndpi_handle_rule(struct ndpi_detection_module_struct *ndpi_str, char *rule,
char *at, *proto, *elem;
ndpi_proto_defaults_t *def;
u_int subprotocol_id, i;
int id;
at = strrchr(rule, '@');
if(at == NULL) {
@@ -3353,14 +3354,11 @@ int ndpi_handle_rule(struct ndpi_detection_module_struct *ndpi_str, char *rule,
}
}
for(i = 0, def = NULL; i < ndpi_str->ndpi_num_supported_protocols; i++) {
if(ndpi_str->proto_defaults[i].protoName
&& strcasecmp(ndpi_str->proto_defaults[i].protoName, proto) == 0) {
def = &ndpi_str->proto_defaults[i];
subprotocol_id = i;
break;
}
}
if((id = ndpi_get_protocol_id(ndpi_str, proto)) != -1) {
subprotocol_id = (u_int)id;
def = &ndpi_str->proto_defaults[subprotocol_id];
} else
def = NULL;
if(def == NULL) {
if(!do_add) {