diff --git a/src/modules/interface/http/interface_http.h b/src/modules/interface/http/interface_http.h index f4eb708..7004d5f 100644 --- a/src/modules/interface/http/interface_http.h +++ b/src/modules/interface/http/interface_http.h @@ -73,6 +73,11 @@ typedef struct interface_http_stats { uint64_t send_erros_total; } interface_http_stats_t; +#if defined(__APPLE__) +#define st_atim st_atimespec +#define st_ctim st_ctimespec +#define st_mtim st_mtimespec +#endif #ifdef USE_IPV6 #include diff --git a/src/modules/protocol/diameter/parser_diameter.h b/src/modules/protocol/diameter/parser_diameter.h index 00f3f3c..1baafe2 100644 --- a/src/modules/protocol/diameter/parser_diameter.h +++ b/src/modules/protocol/diameter/parser_diameter.h @@ -28,7 +28,6 @@ #include #include -#include #include #include diff --git a/src/modules/protocol/rtcpxr/parser_rtcpxr.h b/src/modules/protocol/rtcpxr/parser_rtcpxr.h index 736f864..d54580a 100644 --- a/src/modules/protocol/rtcpxr/parser_rtcpxr.h +++ b/src/modules/protocol/rtcpxr/parser_rtcpxr.h @@ -28,7 +28,6 @@ #include #include -#include #include #include #include "../../../../include/captagent/api.h" diff --git a/src/modules/protocol/sip/protocol_sip.h b/src/modules/protocol/sip/protocol_sip.h index e2a5b60..58530d0 100644 --- a/src/modules/protocol/sip/protocol_sip.h +++ b/src/modules/protocol/sip/protocol_sip.h @@ -57,7 +57,6 @@ typedef struct protocol_sip_stats { static protocol_sip_stats_t stats; -extern char* usefile; extern int handler(int value); extern int set_raw_rtp_filter(); diff --git a/src/modules/socket/collector/socket_collector.h b/src/modules/socket/collector/socket_collector.h index 51801de..8f09ffb 100644 --- a/src/modules/socket/collector/socket_collector.h +++ b/src/modules/socket/collector/socket_collector.h @@ -39,7 +39,6 @@ extern char *global_config_path; extern char *global_scripts_path; -extern char *usefile; extern int handler(int value); #define MAX_SOCKETS 10 diff --git a/src/modules/socket/pcap/socket_pcap.c b/src/modules/socket/pcap/socket_pcap.c index d86564c..a486838 100755 --- a/src/modules/socket/pcap/socket_pcap.c +++ b/src/modules/socket/pcap/socket_pcap.c @@ -46,8 +46,7 @@ #ifndef __FAVOR_BSD #define __FAVOR_BSD #endif -#include -#include +#include #include #include #include @@ -305,7 +304,7 @@ void callback_proto(unsigned char *arg, struct pcap_pkthdr *pkthdr, unsigned cha } msg_t _msg; - struct ethhdr* eth = NULL; + struct ether_header* eth = NULL; struct sll_header* sll = NULL; struct sll2_header* sll2 = NULL; struct ip* ip4_pkt = NULL; @@ -469,7 +468,7 @@ void callback_proto(unsigned char *arg, struct pcap_pkthdr *pkthdr, unsigned cha memcpy(ðaddr, (packet + 12), 2); memcpy(&mplsaddr, (packet + 16), 2); - if (ntohs((uint16_t)*(ðaddr)) == VLAN) { + if (ntohs((uint16_t)*(ðaddr)) == ETHERTYPE_VLAN) { if (ntohs((uint16_t)*(&mplsaddr)) == MPLS_UNI) { hdr_offset = 8; vlan = 1; @@ -485,21 +484,18 @@ void callback_proto(unsigned char *arg, struct pcap_pkthdr *pkthdr, unsigned cha } else if (type_datalink == DLT_LINUX_SLL2) { sll2 = (struct sll2_header *)(packet + hdr_preset); } else { - eth = (struct ethhdr *)(packet + hdr_preset); + eth = (struct ether_header *)(packet + hdr_preset); } if (eth) { - //snprintf(mac_src, sizeof(mac_src), "%.2X-%.2X-%.2X-%.2X-%.2X-%.2X", eth->ether_shost[0], eth->ether_shost[1], eth->ether_shost[2], eth->ether_shost[3], eth->ether_shost[4], eth->ether_shost[5]); - //snprintf(mac_dst, sizeof(mac_dst), "%.2X-%.2X-%.2X-%.2X-%.2X-%.2X", eth->ether_dhost[0], eth->ether_dhost[1], eth->ether_dhost[2], eth->ether_dhost[3], eth->ether_dhost[4], eth->ether_dhost[5]); snprintf(mac_src, sizeof(mac_src), "%.2X-%.2X-%.2X-%.2X-%.2X-%.2X", - eth->h_source[0], eth->h_source[1], eth->h_source[2], eth->h_source[3], eth->h_source[4], eth->h_source[5]); + eth->ether_shost[0], eth->ether_shost[1], eth->ether_shost[2], eth->ether_shost[3], eth->ether_shost[4], eth->ether_shost[5]); snprintf(mac_dst, sizeof(mac_dst), "%.2X-%.2X-%.2X-%.2X-%.2X-%.2X", - eth->h_dest[0], eth->h_dest[1], eth->h_dest[2], eth->h_dest[3], eth->h_dest[4], eth->h_dest[5]); + eth->ether_dhost[0], eth->ether_dhost[1], eth->ether_dhost[2], eth->ether_dhost[3], eth->ether_dhost[4], eth->ether_dhost[5]); if(vlan == 0 || vlan == 2) { // IP TYPE = 0x86dd (IPv6) or 0x0800 (IPv4) or (0x8100 VLAN) - //type_ip = ntohs(eth->ether_type); - type_ip = ntohs(eth->h_proto); + type_ip = ntohs(eth->ether_type); } } /* Linux cooked capture (v1 and v2) shows only Source MAC address */ @@ -1223,7 +1219,7 @@ void* proto_collect(void *arg) { /* detect link_offset */ switch (type_datalink) { case DLT_EN10MB: - link_offset = ETHHDR_SIZE; + link_offset = ETHER_HDR_LEN; break; case DLT_IEEE802: diff --git a/src/modules/socket/pcap/socket_pcap.h b/src/modules/socket/pcap/socket_pcap.h index 0324ec5..acc9a56 100644 --- a/src/modules/socket/pcap/socket_pcap.h +++ b/src/modules/socket/pcap/socket_pcap.h @@ -29,7 +29,6 @@ #include -extern char *usefile; extern int handler(int value); extern char *global_config_path; extern char *global_scripts_path; @@ -37,7 +36,6 @@ extern char *global_scripts_path; /* Ethernet type in case of vlan or mpls header */ #define IPV4_SIZE 20 #define ERSPANHDR_SIZE 16 -#define VLAN 0x8100 #define MPLS_UNI 0x8847 #define MPLS_MULTI 0x8848 #define ERSPAN 0x88be @@ -77,7 +75,6 @@ struct sll2_header { #endif /* header offsets */ -#define ETHHDR_SIZE 14 #define TOKENRING_SIZE 22 #define PPPHDR_SIZE 4 #define SLIPHDR_SIZE 16 diff --git a/src/modules/socket/tzsp/socket_tzsp.h b/src/modules/socket/tzsp/socket_tzsp.h index aefaa54..a0ab61c 100644 --- a/src/modules/socket/tzsp/socket_tzsp.h +++ b/src/modules/socket/tzsp/socket_tzsp.h @@ -50,7 +50,6 @@ extern char *global_config_path; extern char *global_scripts_path; -extern char *usefile; extern int handler(int value); #define MAX_SOCKETS 10