Update ndpi_ethernet definition

This commit is contained in:
Luca
2015-11-12 15:32:44 +01:00
parent 8399afa607
commit a407da79a9
2 changed files with 55 additions and 59 deletions
+1 -1
View File
@@ -1667,7 +1667,7 @@ static void pcap_packet_callback(u_char *args,
case DLT_EN10MB : case DLT_EN10MB :
ethernet = (struct ndpi_ethhdr *) &packet[eth_offset]; ethernet = (struct ndpi_ethhdr *) &packet[eth_offset];
ip_offset = sizeof(struct ndpi_ethhdr) + eth_offset; ip_offset = sizeof(struct ndpi_ethhdr) + eth_offset;
check = ntohs(ethernet->h_lt); check = ntohs(ethernet->h_proto);
if(check <= 1500) if(check <= 1500)
pyld_eth_len = check; pyld_eth_len = check;
+31 -35
View File
@@ -34,20 +34,20 @@
/* NDPI_LOG_LEVEL */ /* NDPI_LOG_LEVEL */
typedef enum typedef enum
{ {
NDPI_LOG_ERROR, NDPI_LOG_ERROR,
NDPI_LOG_TRACE, NDPI_LOG_TRACE,
NDPI_LOG_DEBUG NDPI_LOG_DEBUG
} ndpi_log_level_t; } ndpi_log_level_t;
/* NDPI_VISIT */ /* NDPI_VISIT */
typedef enum typedef enum
{ {
ndpi_preorder, ndpi_preorder,
ndpi_postorder, ndpi_postorder,
ndpi_endorder, ndpi_endorder,
ndpi_leaf ndpi_leaf
} ndpi_VISIT; } ndpi_VISIT;
/* NDPI_NODE */ /* NDPI_NODE */
typedef struct node_t typedef struct node_t
@@ -106,21 +106,22 @@ struct ndpi_cdp
u_int16_t length; u_int16_t length;
} __attribute__((packed)); } __attribute__((packed));
/* +++++++++++++++ Ethernet header (IEEE 802.3) +++++++++++++++ */ /* +++++++++++++++ Ethernet header (IEEE 802.3) +++++++++++++++ */
struct ndpi_ethhdr struct ndpi_ethhdr
{ {
u_char h_dest[6]; /* destination eth addr */ u_char h_dest[6]; /* destination eth addr */
u_char h_source[6]; /* source ether addr */ u_char h_source[6]; /* source ether addr */
u_int16_t h_lt; /* data length (<= 1500) or type ID proto (>=1536) */ u_int16_t h_proto; /* data length (<= 1500) or type ID proto (>=1536) */
} __attribute__((packed)); } __attribute__((packed));
/* +++++++++++++++++++ LLC header (IEEE 802.2) ++++++++++++++++ */ /* +++++++++++++++++++ LLC header (IEEE 802.2) ++++++++++++++++ */
struct ndpi_snap_extension struct ndpi_snap_extension
{ {
u_int16_t oui; u_int16_t oui;
u_int8_t oui2; u_int8_t oui2;
u_int16_t proto_ID; u_int16_t proto_ID;
} __attribute__((packed)); } __attribute__((packed));
struct ndpi_llc_header struct ndpi_llc_header
@@ -133,7 +134,6 @@ struct ndpi_llc_header
#endif #endif
} __attribute__((packed)); } __attribute__((packed));
/* ++++++++++ RADIO TAP header (for IEEE 802.11) +++++++++++++ */ /* ++++++++++ RADIO TAP header (for IEEE 802.11) +++++++++++++ */
struct ndpi_radiotap_header struct ndpi_radiotap_header
{ {
@@ -158,17 +158,14 @@ struct ndpi_wifi_header
/* u_int64_t ccmp - for data encription only - check fc.flag */ /* u_int64_t ccmp - for data encription only - check fc.flag */
} __attribute__((packed)); } __attribute__((packed));
/* +++++++++++++++++++++++ MPLS header +++++++++++++++++++++++ */ /* +++++++++++++++++++++++ MPLS header +++++++++++++++++++++++ */
struct ndpi_mpls_header struct ndpi_mpls_header
{ {
u_int32_t label:20, exp:3, s:1, ttl:8; u_int32_t label:20, exp:3, s:1, ttl:8;
} __attribute__((packed)); } __attribute__((packed));
/* ++++++++++++++++++++++++ IP header ++++++++++++++++++++++++ */ /* ++++++++++++++++++++++++ IP header ++++++++++++++++++++++++ */
struct ndpi_iphdr { struct ndpi_iphdr {
#if defined(__LITTLE_ENDIAN__) #if defined(__LITTLE_ENDIAN__)
u_int8_t ihl:4, version:4; u_int8_t ihl:4, version:4;
@@ -188,7 +185,6 @@ struct ndpi_iphdr {
u_int32_t daddr; u_int32_t daddr;
} __attribute__((packed)); } __attribute__((packed));
/* +++++++++++++++++++++++ IPv6 header +++++++++++++++++++++++ */ /* +++++++++++++++++++++++ IPv6 header +++++++++++++++++++++++ */
/* rfc3542 */ /* rfc3542 */
@@ -215,13 +211,13 @@ struct ndpi_ipv6hdr
} ip6_un1; } ip6_un1;
u_int8_t ip6_un2_vfc; u_int8_t ip6_un2_vfc;
} ip6_ctlun; } ip6_ctlun;
struct ndpi_in6_addr ip6_src; struct ndpi_in6_addr ip6_src;
struct ndpi_in6_addr ip6_dst; struct ndpi_in6_addr ip6_dst;
} __attribute__((packed)); } __attribute__((packed));
/* +++++++++++++++++++++++ TCP header +++++++++++++++++++++++ */ /* +++++++++++++++++++++++ TCP header +++++++++++++++++++++++ */
struct ndpi_tcphdr struct ndpi_tcphdr
{ {
u_int16_t source; u_int16_t source;
@@ -241,6 +237,7 @@ struct ndpi_tcphdr
} __attribute__((packed)); } __attribute__((packed));
/* +++++++++++++++++++++++ UDP header +++++++++++++++++++++++ */ /* +++++++++++++++++++++++ UDP header +++++++++++++++++++++++ */
struct ndpi_udphdr struct ndpi_udphdr
{ {
u_int16_t source; u_int16_t source;
@@ -249,8 +246,6 @@ struct ndpi_udphdr
u_int16_t check; u_int16_t check;
} __attribute__((packed)); } __attribute__((packed));
typedef union typedef union
{ {
u_int32_t ipv4; u_int32_t ipv4;
@@ -265,9 +260,11 @@ typedef union
/* ************************************************************ */ /* ************************************************************ */
#ifdef NDPI_PROTOCOL_BITTORRENT #ifdef NDPI_PROTOCOL_BITTORRENT
typedef struct spinlock { typedef struct spinlock {
volatile int val; volatile int val;
} spinlock_t; } spinlock_t;
typedef struct atomic { typedef struct atomic {
volatile int counter; volatile int counter;
} atomic_t; } atomic_t;
@@ -317,12 +314,11 @@ typedef enum {
} ndpi_http_method; } ndpi_http_method;
typedef struct ndpi_id_struct { typedef struct ndpi_id_struct {
/** /**
detected_protocol_bitmask: detected_protocol_bitmask:
access this bitmask to find out whether an id has used skype or not access this bitmask to find out whether an id has used skype or not
if a flag is set here, it will not be resetted if a flag is set here, it will not be resetted
to compare this, use: to compare this, use:
**/ **/
NDPI_PROTOCOL_BITMASK detected_protocol_bitmask; NDPI_PROTOCOL_BITMASK detected_protocol_bitmask;
#ifdef NDPI_PROTOCOL_RTSP #ifdef NDPI_PROTOCOL_RTSP
@@ -628,9 +624,9 @@ typedef struct ndpi_packet_struct {
#if !defined(WIN32) #if !defined(WIN32)
__attribute__ ((__packed__)) __attribute__ ((__packed__))
#endif #endif
u_int16_t protocol_stack_info; u_int16_t protocol_stack_info;
struct ndpi_int_one_line_struct line[NDPI_MAX_PARSE_LINES_PER_PACKET]; struct ndpi_int_one_line_struct line[NDPI_MAX_PARSE_LINES_PER_PACKET];
struct ndpi_int_one_line_struct host_line; struct ndpi_int_one_line_struct host_line;
@@ -826,9 +822,9 @@ typedef struct ndpi_detection_module_struct {
typedef struct ndpi_flow_struct { typedef struct ndpi_flow_struct {
u_int16_t detected_protocol_stack[NDPI_PROTOCOL_HISTORY_SIZE]; u_int16_t detected_protocol_stack[NDPI_PROTOCOL_HISTORY_SIZE];
#if !defined(WIN32) #if !defined(WIN32)
__attribute__ ((__packed__)) __attribute__ ((__packed__))
#endif #endif
u_int16_t protocol_stack_info; u_int16_t protocol_stack_info;
/* init parameter, internal used to set up timestamp,... */ /* init parameter, internal used to set up timestamp,... */
u_int16_t guessed_protocol_id, guessed_host_proto_id; u_int16_t guessed_protocol_id, guessed_host_proto_id;