Merge branch 'alagoutte-warning' into dev
This commit is contained in:
@@ -573,7 +573,7 @@ static void on_protocol_discovered(struct ndpi_workflow * workflow,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
/**
|
/**
|
||||||
* @brief Print debug
|
* @brief Print debug
|
||||||
*/
|
*/
|
||||||
@@ -612,7 +612,7 @@ static void debug_printf(u_int32_t protocol, void *id_struct,
|
|||||||
|
|
||||||
va_end(va_ap);
|
va_end(va_ap);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Setup for detection begin
|
* @brief Setup for detection begin
|
||||||
|
|||||||
+2
-13
@@ -79,10 +79,6 @@ void ndpi_free_flow_info_half(struct ndpi_flow_info *flow) {
|
|||||||
|
|
||||||
/* ***************************************************** */
|
/* ***************************************************** */
|
||||||
|
|
||||||
static const u_int8_t nDPI_traceLevel = 0;
|
|
||||||
|
|
||||||
/* ***************************************************** */
|
|
||||||
|
|
||||||
extern u_int32_t current_ndpi_memory, max_ndpi_memory;
|
extern u_int32_t current_ndpi_memory, max_ndpi_memory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -542,17 +538,11 @@ void ndpi_workflow_process_packet (struct ndpi_workflow * workflow,
|
|||||||
|
|
||||||
/* --- Ethernet header --- */
|
/* --- Ethernet header --- */
|
||||||
const struct ndpi_ethhdr *ethernet;
|
const struct ndpi_ethhdr *ethernet;
|
||||||
/* --- Ethernet II header --- */
|
|
||||||
const struct ndpi_ethhdr *ethernet_2;
|
|
||||||
/* --- LLC header --- */
|
/* --- LLC header --- */
|
||||||
const struct ndpi_llc_header *llc;
|
const struct ndpi_llc_header *llc;
|
||||||
|
|
||||||
/* --- Cisco HDLC header --- */
|
/* --- Cisco HDLC header --- */
|
||||||
const struct ndpi_chdlc *chdlc;
|
const struct ndpi_chdlc *chdlc;
|
||||||
/* --- SLARP frame --- */
|
|
||||||
struct ndpi_slarp *slarp;
|
|
||||||
/* --- CDP --- */
|
|
||||||
struct ndpi_cdp *cdp;
|
|
||||||
|
|
||||||
/* --- Radio Tap header --- */
|
/* --- Radio Tap header --- */
|
||||||
const struct ndpi_radiotap_header *radiotap;
|
const struct ndpi_radiotap_header *radiotap;
|
||||||
@@ -571,13 +561,12 @@ void ndpi_workflow_process_packet (struct ndpi_workflow * workflow,
|
|||||||
u_int16_t eth_offset = 0;
|
u_int16_t eth_offset = 0;
|
||||||
u_int16_t radio_len;
|
u_int16_t radio_len;
|
||||||
u_int16_t fc;
|
u_int16_t fc;
|
||||||
u_int16_t type;
|
u_int16_t type = 0;
|
||||||
int wifi_len = 0;
|
int wifi_len = 0;
|
||||||
int llc_off;
|
|
||||||
int pyld_eth_len = 0;
|
int pyld_eth_len = 0;
|
||||||
int check;
|
int check;
|
||||||
u_int64_t time;
|
u_int64_t time;
|
||||||
u_int16_t ip_offset, ip_len, ip6_offset;
|
u_int16_t ip_offset = 0, ip_len;
|
||||||
u_int16_t frag_off = 0, vlan_id = 0;
|
u_int16_t frag_off = 0, vlan_id = 0;
|
||||||
u_int8_t proto = 0;
|
u_int8_t proto = 0;
|
||||||
u_int32_t label;
|
u_int32_t label;
|
||||||
|
|||||||
+4
-4
@@ -1927,8 +1927,6 @@ static ndpi_default_ports_tree_node_t* ndpi_get_guessed_protocol_id(struct ndpi_
|
|||||||
u_int16_t ndpi_guess_protocol_id(struct ndpi_detection_module_struct *ndpi_struct,
|
u_int16_t ndpi_guess_protocol_id(struct ndpi_detection_module_struct *ndpi_struct,
|
||||||
u_int8_t proto, u_int16_t sport, u_int16_t dport,
|
u_int8_t proto, u_int16_t sport, u_int16_t dport,
|
||||||
u_int8_t *user_defined_proto) {
|
u_int8_t *user_defined_proto) {
|
||||||
const void *ret;
|
|
||||||
ndpi_default_ports_tree_node_t node;
|
|
||||||
|
|
||||||
*user_defined_proto = 0; /* Default */
|
*user_defined_proto = 0; /* Default */
|
||||||
if(sport && dport) {
|
if(sport && dport) {
|
||||||
@@ -3489,14 +3487,13 @@ ndpi_protocol ndpi_detection_process_packet(struct ndpi_detection_module_struct
|
|||||||
flow->packet.iph)) {
|
flow->packet.iph)) {
|
||||||
u_int16_t sport, dport;
|
u_int16_t sport, dport;
|
||||||
u_int8_t protocol;
|
u_int8_t protocol;
|
||||||
u_int32_t saddr, daddr;
|
|
||||||
u_int8_t user_defined_proto;
|
u_int8_t user_defined_proto;
|
||||||
|
|
||||||
flow->protocol_id_already_guessed = 1;
|
flow->protocol_id_already_guessed = 1;
|
||||||
|
|
||||||
#ifdef NDPI_DETECTION_SUPPORT_IPV6
|
#ifdef NDPI_DETECTION_SUPPORT_IPV6
|
||||||
if(flow->packet.iphv6 != NULL) {
|
if(flow->packet.iphv6 != NULL) {
|
||||||
protocol = flow->packet.iphv6->ip6_ctlun.ip6_un1.ip6_un1_nxt, saddr = 0, daddr = 0;
|
protocol = flow->packet.iphv6->ip6_ctlun.ip6_un1.ip6_un1_nxt;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@@ -4467,6 +4464,9 @@ const char* ndpi_category_str(ndpi_protocol_category_t category) {
|
|||||||
case NDPI_PROTOCOL_CATEGORY_SYSTEM:
|
case NDPI_PROTOCOL_CATEGORY_SYSTEM:
|
||||||
return("System");
|
return("System");
|
||||||
break;
|
break;
|
||||||
|
case NDPI_PROTOCOL_CATEGORY_UNSPECIFIED:
|
||||||
|
return("Unspecified");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return("Unspecified");
|
return("Unspecified");
|
||||||
|
|||||||
@@ -24,12 +24,6 @@
|
|||||||
|
|
||||||
#ifdef NDPI_PROTOCOL_BGP
|
#ifdef NDPI_PROTOCOL_BGP
|
||||||
|
|
||||||
|
|
||||||
static void ndpi_int_bgp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
|
||||||
{
|
|
||||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_BGP, NDPI_PROTOCOL_UNKNOWN);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* this detection also works asymmetrically */
|
/* this detection also works asymmetrically */
|
||||||
void ndpi_search_bgp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
void ndpi_search_bgp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,16 +57,15 @@ static void ndpi_add_connection_as_bittorrent(struct ndpi_detection_module_struc
|
|||||||
{
|
{
|
||||||
if(check_hash) {
|
if(check_hash) {
|
||||||
const char *bt_hash = NULL; /* 20 bytes long */
|
const char *bt_hash = NULL; /* 20 bytes long */
|
||||||
const char *peer_id = NULL; /* 20 bytes long */
|
|
||||||
|
|
||||||
if(bt_offset == -1) {
|
if(bt_offset == -1) {
|
||||||
const char *bt_magic = ndpi_strnstr((const char *)flow->packet.payload,
|
const char *bt_magic = ndpi_strnstr((const char *)flow->packet.payload,
|
||||||
"BitTorrent protocol", flow->packet.payload_packet_len);
|
"BitTorrent protocol", flow->packet.payload_packet_len);
|
||||||
|
|
||||||
if(bt_magic)
|
if(bt_magic)
|
||||||
bt_hash = &bt_magic[19], peer_id = &bt_magic[39];
|
bt_hash = &bt_magic[19];
|
||||||
} else
|
} else
|
||||||
bt_hash = (const char*)&flow->packet.payload[28], peer_id = (const char*)&flow->packet.payload[48];
|
bt_hash = (const char*)&flow->packet.payload[28];
|
||||||
|
|
||||||
if(bt_hash) memcpy(flow->bittorent_hash, bt_hash, 20);
|
if(bt_hash) memcpy(flow->bittorent_hash, bt_hash, 20);
|
||||||
}
|
}
|
||||||
@@ -385,7 +384,6 @@ static void ndpi_int_search_bittorrent_tcp(struct ndpi_detection_module_struct *
|
|||||||
void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||||
{
|
{
|
||||||
struct ndpi_packet_struct *packet = &flow->packet;
|
struct ndpi_packet_struct *packet = &flow->packet;
|
||||||
int no_bittorrent = 0;
|
|
||||||
char *bt_proto = NULL;
|
char *bt_proto = NULL;
|
||||||
|
|
||||||
/* This is broadcast */
|
/* This is broadcast */
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ void ndpi_search_git(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
const u_int8_t * pp = packet->payload;
|
const u_int8_t * pp = packet->payload;
|
||||||
u_int16_t payload_len = packet->payload_packet_len;
|
u_int16_t payload_len = packet->payload_packet_len;
|
||||||
u_int8_t found_git = 1;
|
u_int8_t found_git = 1;
|
||||||
u_int16_t git_len = 0, offset = 0;
|
u_int16_t offset = 0;
|
||||||
|
|
||||||
while((offset+4) < payload_len) {
|
while((offset+4) < payload_len) {
|
||||||
char len[5];
|
char len[5];
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ void ndpi_search_quic(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
&& ((packet->payload[0] & 0xC2) == 0x00)
|
&& ((packet->payload[0] & 0xC2) == 0x00)
|
||||||
&& (quic_ports(ntohs(packet->udp->source), ntohs(packet->udp->dest)))
|
&& (quic_ports(ntohs(packet->udp->source), ntohs(packet->udp->dest)))
|
||||||
) {
|
) {
|
||||||
char *begin;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if((version_len > 0) && (packet->payload[1+cid_len] != 'Q'))
|
if((version_len > 0) && (packet->payload[1+cid_len] != 'Q'))
|
||||||
|
|||||||
@@ -78,8 +78,6 @@ void ndpi_check_rx(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
{
|
{
|
||||||
struct ndpi_packet_struct *packet = &flow->packet;
|
struct ndpi_packet_struct *packet = &flow->packet;
|
||||||
u_int32_t payload_len = packet->payload_packet_len;
|
u_int32_t payload_len = packet->payload_packet_len;
|
||||||
int found = 0;
|
|
||||||
|
|
||||||
|
|
||||||
NDPI_LOG(NDPI_PROTOCOL_RX, ndpi_struct, NDPI_LOG_DEBUG, "RX: pck: %d, dir[0]: %d, dir[1]: %d\n",
|
NDPI_LOG(NDPI_PROTOCOL_RX, ndpi_struct, NDPI_LOG_DEBUG, "RX: pck: %d, dir[0]: %d, dir[1]: %d\n",
|
||||||
flow->packet_counter, flow->packet_direction_counter[0], flow->packet_direction_counter[1]);
|
flow->packet_counter, flow->packet_direction_counter[0], flow->packet_direction_counter[1]);
|
||||||
|
|||||||
Reference in New Issue
Block a user