aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2015-05-19 08:14:52 +0200
committerLuca Deri <deri@ntop.org>2015-05-19 08:14:52 +0200
commitad28d5ff7b5d5793172032281a9527bac4e64a62 (patch)
tree0da81a98712bf4ee05eac72082da7740643731af /src
parentc6d09df8846e6566d7d11b471732d11e15f8b93f (diff)
parent167c83121262c4621b56f1cb3927bf5f8a5f9a69 (diff)
Merge branch 'dev' of https://github.com/ntop/nDPI into dev
Diffstat (limited to 'src')
-rw-r--r--src/include/ndpi_typedefs.h54
-rw-r--r--src/lib/ndpi_main.c2
-rw-r--r--src/lib/protocols/warcraft3.c2
-rw-r--r--src/lib/third_party/include/ndpi_patricia.h6
4 files changed, 34 insertions, 30 deletions
diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h
index 5bdd5a6e6..1afca2138 100644
--- a/src/include/ndpi_typedefs.h
+++ b/src/include/ndpi_typedefs.h
@@ -32,8 +32,8 @@ typedef enum {
} ndpi_log_level_t;
typedef void (*ndpi_debug_function_ptr) (u_int32_t protocol,
- void *module_struct, ndpi_log_level_t log_level,
- const char *format, ...);
+ void *module_struct, ndpi_log_level_t log_level,
+ const char *format, ...);
#define BT_ANNOUNCE
typedef enum {
@@ -102,43 +102,43 @@ typedef union {
#ifdef NDPI_PROTOCOL_BITTORRENT
#ifndef __KERNEL__
typedef struct spinlock {
- volatile int val;
+ volatile int val;
} spinlock_t;
typedef struct atomic {
- volatile int counter;
+ volatile int counter;
} atomic_t;
#endif
struct hash_ip4p_node {
- struct hash_ip4p_node *next,*prev;
- time_t lchg;
- u_int16_t port,count:12,flag:4;
- u_int32_t ip;
- // + 12 bytes for ipv6
+ struct hash_ip4p_node *next,*prev;
+ time_t lchg;
+ u_int16_t port,count:12,flag:4;
+ u_int32_t ip;
+ // + 12 bytes for ipv6
};
struct hash_ip4p {
- struct hash_ip4p_node *top;
- spinlock_t lock;
- size_t len;
+ struct hash_ip4p_node *top;
+ spinlock_t lock;
+ size_t len;
};
struct hash_ip4p_table {
- size_t size;
- int ipv6;
- spinlock_t lock;
- atomic_t count;
- struct hash_ip4p tbl[0];
+ size_t size;
+ int ipv6;
+ spinlock_t lock;
+ atomic_t count;
+ struct hash_ip4p tbl;
};
struct bt_announce { // 192 bytes
- u_int32_t hash[5];
- u_int32_t ip[4];
- u_int32_t time;
- u_int16_t port;
- u_int8_t name_len,
- name[192 - 4*10 - 2 - 1]; // 149 bytes
+ u_int32_t hash[5];
+ u_int32_t ip[4];
+ u_int32_t time;
+ u_int16_t port;
+ u_int8_t name_len,
+ name[192 - 4*10 - 2 - 1]; // 149 bytes
};
#endif
@@ -174,7 +174,7 @@ typedef struct ndpi_id_struct {
u_int32_t yahoo_video_lan_timer;
#endif
#endif
-/* NDPI_PROTOCOL_IRC_MAXPORT % 2 must be 0 */
+ /* NDPI_PROTOCOL_IRC_MAXPORT % 2 must be 0 */
#ifdef NDPI_PROTOCOL_IRC
#define NDPI_PROTOCOL_IRC_MAXPORT 8
u_int16_t irc_port[NDPI_PROTOCOL_IRC_MAXPORT];
@@ -518,8 +518,8 @@ typedef struct ndpi_packet_struct {
u_int8_t ssl_certificate_detected:4, ssl_certificate_num_checks:4;
u_int8_t packet_lines_parsed_complete:1,
- packet_direction:1,
- empty_line_position_set:1;
+ packet_direction:1,
+ empty_line_position_set:1;
} ndpi_packet_struct_t;
struct ndpi_detection_module_struct;
@@ -710,7 +710,7 @@ typedef struct ndpi_flow_struct {
Pointer to src or dst
that identifies the
server of this connection
- */
+ */
#ifndef __KERNEL__
u_char host_server_name[256]; /* HTTP host or DNS query */
#else
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 722984953..7719f766e 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -4212,7 +4212,7 @@ unsigned int ndpi_detection_process_packet(struct ndpi_detection_module_struct *
flow->packet.tick_timestamp = d;
}
#else
- flow->packet.tick_timestamp = current_tick_l/1000;
+ flow->packet.tick_timestamp = (u_int32_t)current_tick_l/1000;
#endif
/* parse packet */
diff --git a/src/lib/protocols/warcraft3.c b/src/lib/protocols/warcraft3.c
index 7780dbf6e..39c93378e 100644
--- a/src/lib/protocols/warcraft3.c
+++ b/src/lib/protocols/warcraft3.c
@@ -43,7 +43,7 @@ void ndpi_search_warcraft3(struct ndpi_detection_module_struct
// struct ndpi_id_struct *src=ndpi_struct->src;
// struct ndpi_id_struct *dst=ndpi_struct->dst;
- u_int32_t l; /*
+ u_int16_t l; /*
Leave it as u_int32_t because otherwise 'u_int16_t temp'
might overflood it and thus generate an infinite loop
*/
diff --git a/src/lib/third_party/include/ndpi_patricia.h b/src/lib/third_party/include/ndpi_patricia.h
index bf4a86259..651e52fc9 100644
--- a/src/lib/third_party/include/ndpi_patricia.h
+++ b/src/lib/third_party/include/ndpi_patricia.h
@@ -44,7 +44,7 @@
#ifndef WIN32
#define PATRICIA_IPV6 HAVE_IPV6
#else
-#define PATRICIA_IPV6 0
+#undef PATRICIA_IPV6
#endif
/* typedef unsigned int u_int; */
@@ -142,7 +142,11 @@ void ndpi_Clear_Patricia (patricia_tree_t *patricia, void_fn_t func);
void ndpi_Destroy_Patricia (patricia_tree_t *patricia, void_fn_t func);
void ndpi_patricia_process (patricia_tree_t *patricia, void_fn2_t func);
+#ifdef WIN32
+#define PATRICIA_MAXBITS 128
+#else
#define PATRICIA_MAXBITS (sizeof(struct in6_addr) * 8)
+#endif
#define PATRICIA_NBIT(x) (0x80 >> ((x) & 0x7f))
#define PATRICIA_NBYTE(x) ((x) >> 3)