|
|
@@ -571,8 +571,13 @@ void ndpi_set_proto_defaults(struct ndpi_detection_module_struct *ndpi_mod,
|
|
|
|
memcpy(&ndpi_mod->proto_defaults[protoId].master_udp_protoId, udp_master_protoId, 2*sizeof(u_int16_t));
|
|
|
|
memcpy(&ndpi_mod->proto_defaults[protoId].master_udp_protoId, udp_master_protoId, 2*sizeof(u_int16_t));
|
|
|
|
|
|
|
|
|
|
|
|
for(j=0; j<MAX_DEFAULT_PORTS; j++) {
|
|
|
|
for(j=0; j<MAX_DEFAULT_PORTS; j++) {
|
|
|
|
if(udpDefPorts[j].port_low != 0) addDefaultPort(ndpi_mod, &udpDefPorts[j], &ndpi_mod->proto_defaults[protoId], 0, &ndpi_mod->udpRoot, __FUNCTION__,__LINE__);
|
|
|
|
if(udpDefPorts[j].port_low != 0)
|
|
|
|
if(tcpDefPorts[j].port_low != 0) addDefaultPort(ndpi_mod, &tcpDefPorts[j], &ndpi_mod->proto_defaults[protoId], 0, &ndpi_mod->tcpRoot, __FUNCTION__,__LINE__);
|
|
|
|
addDefaultPort(ndpi_mod, &udpDefPorts[j],
|
|
|
|
|
|
|
|
&ndpi_mod->proto_defaults[protoId], 0, &ndpi_mod->udpRoot, __FUNCTION__,__LINE__);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(tcpDefPorts[j].port_low != 0)
|
|
|
|
|
|
|
|
addDefaultPort(ndpi_mod, &tcpDefPorts[j],
|
|
|
|
|
|
|
|
&ndpi_mod->proto_defaults[protoId], 0, &ndpi_mod->tcpRoot, __FUNCTION__,__LINE__);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@@ -912,13 +917,30 @@ int ndpi_set_detection_preferences(struct ndpi_detection_module_struct *ndpi_mod
|
|
|
|
|
|
|
|
|
|
|
|
/* ******************************************************************** */
|
|
|
|
/* ******************************************************************** */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void ndpi_validate_protocol_initialization(struct ndpi_detection_module_struct *ndpi_mod) {
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(i=0; i<(int)ndpi_mod->ndpi_num_supported_protocols; i++) {
|
|
|
|
|
|
|
|
if(ndpi_mod->proto_defaults[i].protoName == NULL) {
|
|
|
|
|
|
|
|
NDPI_LOG_ERR(ndpi_mod, "[NDPI] INTERNAL ERROR missing protoName initialization for [protoId=%d]: recovering\n", i);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if((i != NDPI_PROTOCOL_UNKNOWN)
|
|
|
|
|
|
|
|
&& (ndpi_mod->proto_defaults[i].protoCategory == NDPI_PROTOCOL_CATEGORY_UNSPECIFIED)) {
|
|
|
|
|
|
|
|
NDPI_LOG_ERR(ndpi_mod, "[NDPI] INTERNAL ERROR missing category [protoId=%d/%s] initialization: recovering\n",
|
|
|
|
|
|
|
|
i, ndpi_mod->proto_defaults[i].protoName ? ndpi_mod->proto_defaults[i].protoName : "???");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ******************************************************************** */
|
|
|
|
|
|
|
|
|
|
|
|
/* This function is used to map protocol name and default ports and it MUST
|
|
|
|
/* This function is used to map protocol name and default ports and it MUST
|
|
|
|
be updated whenever a new protocol is added to NDPI.
|
|
|
|
be updated whenever a new protocol is added to NDPI.
|
|
|
|
|
|
|
|
|
|
|
|
Do NOT add web services (NDPI_SERVICE_xxx) here.
|
|
|
|
Do NOT add web services (NDPI_SERVICE_xxx) here.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndpi_mod) {
|
|
|
|
static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndpi_mod) {
|
|
|
|
|
|
|
|
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
ndpi_port_range ports_a[MAX_DEFAULT_PORTS], ports_b[MAX_DEFAULT_PORTS];
|
|
|
|
ndpi_port_range ports_a[MAX_DEFAULT_PORTS], ports_b[MAX_DEFAULT_PORTS];
|
|
|
|
u_int16_t no_master[2] = { NDPI_PROTOCOL_NO_MASTER_PROTO, NDPI_PROTOCOL_NO_MASTER_PROTO },
|
|
|
|
u_int16_t no_master[2] = { NDPI_PROTOCOL_NO_MASTER_PROTO, NDPI_PROTOCOL_NO_MASTER_PROTO },
|
|
|
@@ -1144,40 +1166,54 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp
|
|
|
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
|
|
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
|
|
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_FREE_40,
|
|
|
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_FREE_40,
|
|
|
|
no_master,
|
|
|
|
no_master,
|
|
|
|
no_master, "Free", NDPI_PROTOCOL_CATEGORY_UNSPECIFIED,
|
|
|
|
no_master, "Free", NDPI_PROTOCOL_CATEGORY_CUSTOM_1 /* dummy */,
|
|
|
|
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
|
|
|
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
|
|
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
|
|
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
|
|
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_FREE_41,
|
|
|
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_FREE_41,
|
|
|
|
no_master,
|
|
|
|
no_master,
|
|
|
|
no_master, "Free", NDPI_PROTOCOL_CATEGORY_UNSPECIFIED,
|
|
|
|
no_master, "Free", NDPI_PROTOCOL_CATEGORY_CUSTOM_1 /* dummy */,
|
|
|
|
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
|
|
|
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
|
|
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
|
|
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
|
|
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_FREE_42,
|
|
|
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_FREE_42,
|
|
|
|
no_master,
|
|
|
|
no_master,
|
|
|
|
no_master, "Free", NDPI_PROTOCOL_CATEGORY_UNSPECIFIED,
|
|
|
|
no_master, "Free", NDPI_PROTOCOL_CATEGORY_CUSTOM_1 /* dummy */,
|
|
|
|
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
|
|
|
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
|
|
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
|
|
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
|
|
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_FREE_43,
|
|
|
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_FREE_43,
|
|
|
|
no_master,
|
|
|
|
no_master,
|
|
|
|
no_master, "Free", NDPI_PROTOCOL_CATEGORY_UNSPECIFIED,
|
|
|
|
no_master, "Free", NDPI_PROTOCOL_CATEGORY_CUSTOM_1 /* dummy */,
|
|
|
|
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
|
|
|
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
|
|
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
|
|
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
|
|
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_FREE_44,
|
|
|
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_FREE_44,
|
|
|
|
no_master,
|
|
|
|
no_master,
|
|
|
|
no_master, "Free", NDPI_PROTOCOL_CATEGORY_UNSPECIFIED,
|
|
|
|
no_master, "Free", NDPI_PROTOCOL_CATEGORY_CUSTOM_1 /* dummy */,
|
|
|
|
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
|
|
|
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
|
|
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
|
|
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
|
|
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_FREE_45,
|
|
|
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_FREE_45,
|
|
|
|
no_master,
|
|
|
|
no_master,
|
|
|
|
no_master, "Free", NDPI_PROTOCOL_CATEGORY_UNSPECIFIED,
|
|
|
|
no_master, "Free", NDPI_PROTOCOL_CATEGORY_CUSTOM_1 /* dummy */,
|
|
|
|
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
|
|
|
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
|
|
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
|
|
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
|
|
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_FREE_46,
|
|
|
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_FREE_46,
|
|
|
|
no_master,
|
|
|
|
no_master,
|
|
|
|
no_master, "Free", NDPI_PROTOCOL_CATEGORY_UNSPECIFIED,
|
|
|
|
no_master, "Free", NDPI_PROTOCOL_CATEGORY_CUSTOM_1 /* dummy */,
|
|
|
|
|
|
|
|
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
|
|
|
|
|
|
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
|
|
|
|
|
|
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_FREE_196,
|
|
|
|
|
|
|
|
no_master,
|
|
|
|
|
|
|
|
no_master, "Free", NDPI_PROTOCOL_CATEGORY_CUSTOM_1 /* dummy */,
|
|
|
|
|
|
|
|
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
|
|
|
|
|
|
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
|
|
|
|
|
|
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_FREE_205,
|
|
|
|
|
|
|
|
no_master,
|
|
|
|
|
|
|
|
no_master, "Free", NDPI_PROTOCOL_CATEGORY_CUSTOM_1 /* dummy */,
|
|
|
|
|
|
|
|
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
|
|
|
|
|
|
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
|
|
|
|
|
|
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_VIDTO,
|
|
|
|
|
|
|
|
no_master,
|
|
|
|
|
|
|
|
no_master, "PPStream", NDPI_PROTOCOL_CATEGORY_MEDIA,
|
|
|
|
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
|
|
|
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
|
|
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
|
|
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_XBOX,
|
|
|
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_XBOX,
|
|
|
|
no_master,
|
|
|
|
no_master,
|
|
|
@@ -1871,14 +1907,7 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp
|
|
|
|
/* calling function for host and content matched protocols */
|
|
|
|
/* calling function for host and content matched protocols */
|
|
|
|
init_string_based_protocols(ndpi_mod);
|
|
|
|
init_string_based_protocols(ndpi_mod);
|
|
|
|
|
|
|
|
|
|
|
|
for(i=0; i<(int)ndpi_mod->ndpi_num_supported_protocols; i++) {
|
|
|
|
ndpi_validate_protocol_initialization(ndpi_mod);
|
|
|
|
if((ndpi_mod->proto_defaults[i].protoName == NULL)
|
|
|
|
|
|
|
|
|| ((i != NDPI_PROTOCOL_UNKNOWN)
|
|
|
|
|
|
|
|
&& (ndpi_mod->proto_defaults[i].protoCategory == NDPI_PROTOCOL_CATEGORY_UNSPECIFIED))) {
|
|
|
|
|
|
|
|
NDPI_LOG_ERR(ndpi_mod, "[NDPI] missing protoId=%d/%s: INTERNAL ERROR: not all protocols have been initialized\n",
|
|
|
|
|
|
|
|
i, ndpi_mod->proto_defaults[i].protoName ? ndpi_mod->proto_defaults[i].protoName : "???");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ****************************************************** */
|
|
|
|
/* ****************************************************** */
|
|
|
|