diff options
Diffstat (limited to 'src/lib/protocols')
-rw-r--r-- | src/lib/protocols/ftp_control.c | 12 | ||||
-rw-r--r-- | src/lib/protocols/http.c | 14 | ||||
-rw-r--r-- | src/lib/protocols/socks45.c | 20 | ||||
-rw-r--r-- | src/lib/protocols/z3950.c | 4 |
4 files changed, 25 insertions, 25 deletions
diff --git a/src/lib/protocols/ftp_control.c b/src/lib/protocols/ftp_control.c index 266fc414a..5a4d1e0a2 100644 --- a/src/lib/protocols/ftp_control.c +++ b/src/lib/protocols/ftp_control.c @@ -600,7 +600,7 @@ static void ndpi_check_ftp_control(struct ndpi_detection_module_struct *ndpi_str } /* Check if we so far detected the protocol in the request or not. */ - if(flow->ftp_control_stage == 0) { + if(flow->l4.tcp.ftp_control_stage == 0) { NDPI_LOG_DBG2(ndpi_struct, "FTP_CONTROL stage 0: \n"); if((payload_len > 0) && ndpi_ftp_control_check_request(ndpi_struct, flow, @@ -612,16 +612,16 @@ static void ndpi_check_ftp_control(struct ndpi_detection_module_struct *ndpi_str Encode the direction of the packet in the stage, so we will know when we need to look for the response packet. */ - flow->ftp_control_stage = packet->packet_direction + 1; + flow->l4.tcp.ftp_control_stage = packet->packet_direction + 1; } } else { - NDPI_LOG_DBG2(ndpi_struct, "FTP_CONTROL stage %u: \n", flow->ftp_control_stage); + NDPI_LOG_DBG2(ndpi_struct, "FTP_CONTROL stage %u: \n", flow->l4.tcp.ftp_control_stage); /* At first check, if this is for sure a response packet (in another direction. If not, do nothing now and return. */ - if((flow->ftp_control_stage - packet->packet_direction) == 1) { + if((flow->l4.tcp.ftp_control_stage - packet->packet_direction) == 1) { return; } @@ -637,7 +637,7 @@ static void ndpi_check_ftp_control(struct ndpi_detection_module_struct *ndpi_str if(flow->l4.tcp.ftp_imap_pop_smtp.password[0] == '\0' && flow->l4.tcp.ftp_imap_pop_smtp.auth_done == 0 && flow->l4.tcp.ftp_imap_pop_smtp.auth_tls == 0) { - flow->ftp_control_stage = 0; + flow->l4.tcp.ftp_control_stage = 0; } else if (flow->l4.tcp.ftp_imap_pop_smtp.auth_tls == 1 && ndpi_struct->cfg.ftp_opportunistic_tls_enabled) { flow->host_server_name[0] = '\0'; /* Remove any data set by other dissectors (eg. SMTP) */ @@ -654,7 +654,7 @@ static void ndpi_check_ftp_control(struct ndpi_detection_module_struct *ndpi_str } else { NDPI_LOG_DBG2(ndpi_struct, "The reply did not seem to belong to FTP_CONTROL, " "resetting the stage to 0\n"); - flow->ftp_control_stage = 0; + flow->l4.tcp.ftp_control_stage = 0; } } } diff --git a/src/lib/protocols/http.c b/src/lib/protocols/http.c index ffc0b9213..319677fe3 100644 --- a/src/lib/protocols/http.c +++ b/src/lib/protocols/http.c @@ -281,7 +281,7 @@ static ndpi_protocol_category_t ndpi_http_check_content(struct ndpi_detection_mo u_int app_len_avail = packet->content_line.len-app_len; if(strncasecmp(app, "mpeg", app_len_avail) == 0) { - flow->guessed_category = flow->category = NDPI_PROTOCOL_CATEGORY_STREAMING; + flow->category = NDPI_PROTOCOL_CATEGORY_STREAMING; return(flow->category); } else { if(app_len_avail > 3) { @@ -301,7 +301,7 @@ static ndpi_protocol_category_t ndpi_http_check_content(struct ndpi_detection_mo if(strncasecmp(app, cmp_mimes[i], app_len_avail) == 0) { char str[64]; - flow->guessed_category = flow->category = NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT; + flow->category = NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT; NDPI_LOG_INFO(ndpi_struct, "found HTTP file transfer"); snprintf(str, sizeof(str), "Found binary mime %s", cmp_mimes[i]); @@ -330,7 +330,7 @@ static ndpi_protocol_category_t ndpi_http_check_content(struct ndpi_detection_mo char str[64]; snprintf(str, sizeof(str), "Found mime exe %s", cmp_mimes[i]); - flow->guessed_category = flow->category = NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT; + flow->category = NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT; ndpi_set_binary_application_transfer(ndpi_struct, flow, str); NDPI_LOG_INFO(ndpi_struct, "Found executable HTTP transfer"); } @@ -393,7 +393,7 @@ static ndpi_protocol_category_t ndpi_http_check_content(struct ndpi_detection_mo binary_exec_file_ext[i], ATTACHMENT_LEN) == 0) { snprintf(str, sizeof(str), "Found file extn %s", binary_exec_file_ext[i]); - flow->guessed_category = flow->category = NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT; + flow->category = NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT; ndpi_set_binary_application_transfer(ndpi_struct, flow, str); NDPI_LOG_INFO(ndpi_struct, "found executable HTTP transfer"); return(flow->category); @@ -413,13 +413,13 @@ static ndpi_protocol_category_t ndpi_http_check_content(struct ndpi_detection_mo case 'a': if(strncasecmp((const char *)packet->content_line.ptr, "audio", ndpi_min(packet->content_line.len, 5)) == 0) - flow->guessed_category = flow->category = NDPI_PROTOCOL_CATEGORY_MEDIA; + flow->category = NDPI_PROTOCOL_CATEGORY_MEDIA; break; case 'v': if(strncasecmp((const char *)packet->content_line.ptr, "video", ndpi_min(packet->content_line.len, 5)) == 0) - flow->guessed_category = flow->category = NDPI_PROTOCOL_CATEGORY_MEDIA; + flow->category = NDPI_PROTOCOL_CATEGORY_MEDIA; break; } } @@ -1106,7 +1106,7 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_ packet->content_line.len); flow->http.content_type[packet->content_line.len] = '\0'; - flow->guessed_category = flow->category = ndpi_http_check_content(ndpi_struct, flow); + flow->category = ndpi_http_check_content(ndpi_struct, flow); } } } diff --git a/src/lib/protocols/socks45.c b/src/lib/protocols/socks45.c index 78a744087..d2da12b13 100644 --- a/src/lib/protocols/socks45.c +++ b/src/lib/protocols/socks45.c @@ -41,7 +41,7 @@ static void ndpi_check_socks4(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t payload_len = packet->payload_packet_len; /* Check if we so far detected the protocol in the request or not. */ - if(flow->socks4_stage == 0) { + if(flow->l4.tcp.socks4_stage == 0) { NDPI_LOG_DBG2(ndpi_struct, "SOCKS4 stage 0: \n"); if(payload_len >= 9 && packet->payload[0] == 0x04 && @@ -50,13 +50,13 @@ static void ndpi_check_socks4(struct ndpi_detection_module_struct *ndpi_struct, NDPI_LOG_DBG2(ndpi_struct, "Possible SOCKS4 request detected, we will look further for the response\n"); /* TODO: check port and ip address is valid */ /* Encode the direction of the packet in the stage, so we will know when we need to look for the response packet. */ - flow->socks4_stage = packet->packet_direction + 1; + flow->l4.tcp.socks4_stage = packet->packet_direction + 1; } } else { - NDPI_LOG_DBG2(ndpi_struct, "SOCKS4 stage %u: \n", flow->socks4_stage); + NDPI_LOG_DBG2(ndpi_struct, "SOCKS4 stage %u: \n", flow->l4.tcp.socks4_stage); /* At first check, if this is for sure a response packet (in another direction. If not, do nothing now and return. */ - if((flow->socks4_stage - packet->packet_direction) == 1) { + if((flow->l4.tcp.socks4_stage - packet->packet_direction) == 1) { return; } /* This is a packet in another direction. Check if we find the proper response. */ @@ -65,7 +65,7 @@ static void ndpi_check_socks4(struct ndpi_detection_module_struct *ndpi_struct, ndpi_int_socks_add_connection(ndpi_struct, flow); } else { NDPI_LOG_DBG2(ndpi_struct, "The reply did not seem to belong to SOCKS4, resetting the stage to 0\n"); - flow->socks4_stage = 0; + flow->l4.tcp.socks4_stage = 0; } } } @@ -76,7 +76,7 @@ static void ndpi_check_socks5(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t payload_len = packet->payload_packet_len; /* Check if we so far detected the protocol in the request or not. */ - if(flow->socks5_stage == 0) { + if(flow->l4.tcp.socks5_stage == 0) { NDPI_LOG_DBG2(ndpi_struct, "SOCKS5 stage 0: \n"); if(((payload_len == 3) && (packet->payload[0] == 0x05) && (packet->payload[1] == 0x01) && (packet->payload[2] == 0x00)) || @@ -84,14 +84,14 @@ static void ndpi_check_socks5(struct ndpi_detection_module_struct *ndpi_struct, NDPI_LOG_DBG2(ndpi_struct, "Possible SOCKS5 request detected, we will look further for the response\n"); /* Encode the direction of the packet in the stage, so we will know when we need to look for the response packet. */ - flow->socks5_stage = packet->packet_direction + 1; + flow->l4.tcp.socks5_stage = packet->packet_direction + 1; } } else { - NDPI_LOG_DBG2(ndpi_struct, "SOCKS5 stage %u: \n", flow->socks5_stage); + NDPI_LOG_DBG2(ndpi_struct, "SOCKS5 stage %u: \n", flow->l4.tcp.socks5_stage); /* At first check, if this is for sure a response packet (in another direction. If not, do nothing now and return. */ - if((flow->socks5_stage - packet->packet_direction) == 1) { + if((flow->l4.tcp.socks5_stage - packet->packet_direction) == 1) { return; } @@ -101,7 +101,7 @@ static void ndpi_check_socks5(struct ndpi_detection_module_struct *ndpi_struct, ndpi_int_socks_add_connection(ndpi_struct, flow); } else { NDPI_LOG_DBG2(ndpi_struct, "The reply did not seem to belong to SOCKS5, resetting the stage to 0\n"); - flow->socks5_stage = 0; + flow->l4.tcp.socks5_stage = 0; } } diff --git a/src/lib/protocols/z3950.c b/src/lib/protocols/z3950.c index 92eed01b0..bddc7ba10 100644 --- a/src/lib/protocols/z3950.c +++ b/src/lib/protocols/z3950.c @@ -103,13 +103,13 @@ static void ndpi_search_z3950(struct ndpi_detection_module_struct *ndpi_struct, return; } - if(flow->z3950_stage == 3) { + if(flow->l4.tcp.z3950_stage == 3) { if(flow->packet_direction_counter[0] && flow->packet_direction_counter[1]) ndpi_int_z3950_add_connection(ndpi_struct, flow); else NDPI_EXCLUDE_PROTO(ndpi_struct, flow); /* Skip if unidirectional traffic */ } else - flow->z3950_stage++; + flow->l4.tcp.z3950_stage++; return; } |