Fix compiler warnings from different compilers clang/gcc
This commit is contained in:
parent
8a9dcb2bc8
commit
9c2e7d6f4a
@ -206,6 +206,9 @@ int i;
|
|||||||
for (i=0; i<ancount && p < eod; i++ ) {
|
for (i=0; i<ancount && p < eod; i++ ) {
|
||||||
uint32_t type, class, ttl;
|
uint32_t type, class, ttl;
|
||||||
int32_t len = dn_expand(payload, eod, p, dn, DN_LENGTH);
|
int32_t len = dn_expand(payload, eod, p, dn, DN_LENGTH);
|
||||||
|
// keep compiler happy
|
||||||
|
UNUSED(class);
|
||||||
|
UNUSED(ttl);
|
||||||
if(len < 0) {
|
if(len < 0) {
|
||||||
LogError("dn_expand() failed: %s", "");
|
LogError("dn_expand() failed: %s", "");
|
||||||
}
|
}
|
||||||
|
@ -1322,6 +1322,8 @@ uint16_t offset_std_sampler_interval, offset_std_sampler_algorithm, found_std_sa
|
|||||||
uint16_t id, length;
|
uint16_t id, length;
|
||||||
int Enterprise;
|
int Enterprise;
|
||||||
|
|
||||||
|
// keep compiler happy
|
||||||
|
UNUSED(enterprise_value);
|
||||||
id = Get_val16(DataPtr); DataPtr += 2;
|
id = Get_val16(DataPtr); DataPtr += 2;
|
||||||
length = Get_val16(DataPtr); DataPtr += 2;
|
length = Get_val16(DataPtr); DataPtr += 2;
|
||||||
size_left -= 4;
|
size_left -= 4;
|
||||||
|
@ -140,7 +140,7 @@ int verbose = 0;
|
|||||||
|
|
||||||
static const char *nfdump_version = VERSION;
|
static const char *nfdump_version = VERSION;
|
||||||
|
|
||||||
static int launcher_alive, periodic_trigger, launcher_pid;
|
static int launcher_pid;
|
||||||
static pthread_mutex_t m_done = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t m_done = PTHREAD_MUTEX_INITIALIZER;
|
||||||
static pthread_cond_t terminate = PTHREAD_COND_INITIALIZER;
|
static pthread_cond_t terminate = PTHREAD_COND_INITIALIZER;
|
||||||
static pthread_key_t buffer_key;
|
static pthread_key_t buffer_key;
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
enum { SRC_IP, DST_IP, UDP_PORT, TCP_PORT, ICMP_TYPE };
|
enum { SRC_IP, DST_IP, UDP_PORT, TCP_PORT, ICMP_TYPE };
|
||||||
|
|
||||||
static pcap_t *pcap_handle;
|
static pcap_t *pcap_handle;
|
||||||
static uint32_t tcp_count, udp_count, icmp_count, arp_count, unknow_count;
|
static uint32_t tcp_count, udp_count, arp_count, unknow_count;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function prototypes
|
* Function prototypes
|
||||||
|
@ -29,12 +29,6 @@
|
|||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Author: haag $
|
|
||||||
*
|
|
||||||
* $Id: profile.c 41 2009-12-31 14:46:28Z haag $
|
|
||||||
*
|
|
||||||
* $LastChangedRevision: 41 $
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -357,7 +351,6 @@ void CloseChannels (time_t tslot, int compress) {
|
|||||||
dirstat_t *dirstat;
|
dirstat_t *dirstat;
|
||||||
struct stat fstat;
|
struct stat fstat;
|
||||||
unsigned int num;
|
unsigned int num;
|
||||||
int ret, update_ok;
|
|
||||||
|
|
||||||
for ( num = 0; num < num_channels; num++ ) {
|
for ( num = 0; num < num_channels; num++ ) {
|
||||||
if ( profile_channels[num].ofile ) {
|
if ( profile_channels[num].ofile ) {
|
||||||
@ -368,10 +361,7 @@ int ret, update_ok;
|
|||||||
profile_channels[num].nffile = DisposeFile(profile_channels[num].nffile);
|
profile_channels[num].nffile = DisposeFile(profile_channels[num].nffile);
|
||||||
|
|
||||||
stat(profile_channels[num].ofile, &fstat);
|
stat(profile_channels[num].ofile, &fstat);
|
||||||
|
ReadStatInfo(profile_channels[num].dirstat_path, &dirstat, CREATE_AND_LOCK);
|
||||||
ret = ReadStatInfo(profile_channels[num].dirstat_path, &dirstat, CREATE_AND_LOCK);
|
|
||||||
update_ok = ret == STATFILE_OK;
|
|
||||||
|
|
||||||
|
|
||||||
if ( rename(profile_channels[num].ofile, profile_channels[num].wfile) < 0 ) {
|
if ( rename(profile_channels[num].ofile, profile_channels[num].wfile) < 0 ) {
|
||||||
LogError("Failed to rename file %s to %s: %s\n",
|
LogError("Failed to rename file %s to %s: %s\n",
|
||||||
|
@ -657,7 +657,6 @@ char *bindhost, *datadir, pidstr[32], *launch_process;
|
|||||||
char *userid, *groupid, *checkptr, *listenport, *mcastgroup, *extension_tags;
|
char *userid, *groupid, *checkptr, *listenport, *mcastgroup, *extension_tags;
|
||||||
char *Ident, *pcap_file, *time_extension, pidfile[MAXPATHLEN];
|
char *Ident, *pcap_file, *time_extension, pidfile[MAXPATHLEN];
|
||||||
struct stat fstat;
|
struct stat fstat;
|
||||||
srecord_t *commbuff;
|
|
||||||
packet_function_t receive_packet;
|
packet_function_t receive_packet;
|
||||||
send_peer_t peer;
|
send_peer_t peer;
|
||||||
FlowSource_t *fs;
|
FlowSource_t *fs;
|
||||||
@ -1012,8 +1011,6 @@ int c;
|
|||||||
exit(255);
|
exit(255);
|
||||||
}
|
}
|
||||||
|
|
||||||
commbuff = (srecord_t *)shmem;
|
|
||||||
|
|
||||||
launcher_pid = fork();
|
launcher_pid = fork();
|
||||||
switch (launcher_pid) {
|
switch (launcher_pid) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -547,6 +547,7 @@ typedef enum {
|
|||||||
SFLAPP_NUM_STATUS_CODES
|
SFLAPP_NUM_STATUS_CODES
|
||||||
} EnumSFLAPPStatus;
|
} EnumSFLAPPStatus;
|
||||||
|
|
||||||
|
#ifdef DEVEL
|
||||||
static const char *SFL_APP_STATUS_names[] = { "SUCCESS",
|
static const char *SFL_APP_STATUS_names[] = { "SUCCESS",
|
||||||
"OTHER",
|
"OTHER",
|
||||||
"TIMEOUT",
|
"TIMEOUT",
|
||||||
@ -558,6 +559,7 @@ typedef enum {
|
|||||||
"NOT_FOUND",
|
"NOT_FOUND",
|
||||||
"UNAVAILABLE",
|
"UNAVAILABLE",
|
||||||
"UNATHORIZED" };
|
"UNATHORIZED" };
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Operation context */
|
/* Operation context */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -64,18 +64,12 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// #include "sflow.h" /* sFlow v5 */
|
#include "sflow.h" /* sFlow v5 */
|
||||||
#include "sflow_v2v4.h" /* sFlow v2/4 */
|
#include "sflow_v2v4.h" /* sFlow v2/4 */
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "sflow_process.h"
|
#include "sflow_process.h"
|
||||||
#include "sflow_nfdump.h"
|
#include "sflow_nfdump.h"
|
||||||
|
|
||||||
#ifndef DEVEL
|
|
||||||
# define dbg_printf(...) /* printf(__VA_ARGS__) */
|
|
||||||
#else
|
|
||||||
# define dbg_printf(...) printf(__VA_ARGS__)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static uint8_t bin2hex(int nib);
|
static uint8_t bin2hex(int nib);
|
||||||
static int printHex(const uint8_t *a, int len, char *buf, int bufLen, int marker, int bytesPerOutputLine);
|
static int printHex(const uint8_t *a, int len, char *buf, int bufLen, int marker, int bytesPerOutputLine);
|
||||||
static char *IP_to_a(uint32_t ipaddr, char *buf, int buflen);
|
static char *IP_to_a(uint32_t ipaddr, char *buf, int buflen);
|
||||||
@ -1463,17 +1457,19 @@ static void readExtendedWifiRx(SFSample *sample)
|
|||||||
|
|
||||||
static void readExtendedWifiTx(SFSample *sample)
|
static void readExtendedWifiTx(SFSample *sample)
|
||||||
{
|
{
|
||||||
|
#ifdef DEVEL
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint8_t *bssid;
|
uint8_t *bssid;
|
||||||
char ssid[SFL_MAX_SSID_LEN+1];
|
char ssid[SFL_MAX_SSID_LEN+1];
|
||||||
if(getString(sample, ssid, SFL_MAX_SSID_LEN) > 0) {
|
if(getString(sample, ssid, SFL_MAX_SSID_LEN) > 0) {
|
||||||
dbg_printf("tx_SSID %s\n", ssid);
|
printf("tx_SSID %s\n", ssid);
|
||||||
}
|
}
|
||||||
|
|
||||||
bssid = (uint8_t *)sample->datap;
|
bssid = (uint8_t *)sample->datap;
|
||||||
dbg_printf("tx_BSSID ");
|
printf("tx_BSSID ");
|
||||||
for(i = 0; i < 6; i++) dbg_printf("%02x", bssid[i]);
|
for(i = 0; i < 6; i++) dbg_printf("%02x", bssid[i]);
|
||||||
dbg_printf("\n");
|
printf("\n");
|
||||||
|
#endif
|
||||||
skipBytes(sample, 6);
|
skipBytes(sample, 6);
|
||||||
|
|
||||||
sf_log_next32(sample, "tx_version");
|
sf_log_next32(sample, "tx_version");
|
||||||
@ -1754,6 +1750,12 @@ static void readFlowSample_http(SFSample *sample, uint32_t tag)
|
|||||||
uint32_t status;
|
uint32_t status;
|
||||||
uint64_t resp_bytes;
|
uint64_t resp_bytes;
|
||||||
|
|
||||||
|
// keep compiler happy
|
||||||
|
UNUSED(method);
|
||||||
|
UNUSED(protocol);
|
||||||
|
UNUSED(status);
|
||||||
|
UNUSED(resp_bytes);
|
||||||
|
|
||||||
dbg_printf("flowSampleType http\n");
|
dbg_printf("flowSampleType http\n");
|
||||||
method = sf_log_next32(sample, "http_method");
|
method = sf_log_next32(sample, "http_method");
|
||||||
protocol = sf_log_next32(sample, "http_protocol");
|
protocol = sf_log_next32(sample, "http_protocol");
|
||||||
@ -1931,6 +1933,9 @@ static void readExtendedProxySocket4(SFSample *sample)
|
|||||||
char buf[51];
|
char buf[51];
|
||||||
#endif
|
#endif
|
||||||
SFLAddress ipsrc,ipdst;
|
SFLAddress ipsrc,ipdst;
|
||||||
|
// keep compiler happy
|
||||||
|
UNUSED(ipsrc);
|
||||||
|
UNUSED(ipdst);
|
||||||
dbg_printf("extendedType proxy_socket4\n");
|
dbg_printf("extendedType proxy_socket4\n");
|
||||||
sf_log_next32(sample, "proxy_socket4_ip_protocol");
|
sf_log_next32(sample, "proxy_socket4_ip_protocol");
|
||||||
ipsrc.type = SFLADDRESSTYPE_IP_V4;
|
ipsrc.type = SFLADDRESSTYPE_IP_V4;
|
||||||
@ -2028,15 +2033,19 @@ static void readExtendedVNI(SFSample *sample, char *prefix)
|
|||||||
|
|
||||||
static void readExtendedTCPInfo(SFSample *sample)
|
static void readExtendedTCPInfo(SFSample *sample)
|
||||||
{
|
{
|
||||||
char *direction;
|
|
||||||
EnumPktDirection dirn = getData32(sample);
|
EnumPktDirection dirn = getData32(sample);
|
||||||
|
UNUSED(dirn); // keep compiler happy
|
||||||
|
#ifdef DEVEL
|
||||||
|
char *direction;
|
||||||
switch(dirn) {
|
switch(dirn) {
|
||||||
case PKTDIR_unknown: direction = "unknown"; break;
|
case PKTDIR_unknown: direction = "unknown"; break;
|
||||||
case PKTDIR_received: direction = "received"; break;
|
case PKTDIR_received: direction = "received"; break;
|
||||||
case PKTDIR_sent: direction = "sent"; break;
|
case PKTDIR_sent: direction = "sent"; break;
|
||||||
default: direction = "<bad value>"; break;
|
default: direction = "<bad value>"; break;
|
||||||
}
|
}
|
||||||
dbg_printf( "tcpinfo_direction %s\n", direction);
|
printf( "tcpinfo_direction %s\n", direction);
|
||||||
|
#endif
|
||||||
|
|
||||||
sf_log_next32(sample, "tcpinfo_send_mss");
|
sf_log_next32(sample, "tcpinfo_send_mss");
|
||||||
sf_log_next32(sample, "tcpinfo_receive_mss");
|
sf_log_next32(sample, "tcpinfo_receive_mss");
|
||||||
sf_log_next32(sample, "tcpinfo_unacked_pkts");
|
sf_log_next32(sample, "tcpinfo_unacked_pkts");
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (c) 2017, Peter Haag
|
||||||
* Copyright (c) 2016, Peter Haag
|
* Copyright (c) 2016, Peter Haag
|
||||||
* Copyright (c) 2014, Peter Haag
|
* Copyright (c) 2014, Peter Haag
|
||||||
* Copyright (c) 2009, Peter Haag
|
* Copyright (c) 2009, Peter Haag
|
||||||
@ -54,6 +55,8 @@
|
|||||||
# define dbg_assert(a) /* assert(a) */
|
# define dbg_assert(a) /* assert(a) */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define UNUSED(expr) do { (void)(expr); } while (0)
|
||||||
|
|
||||||
#define EBUFF_SIZE 256
|
#define EBUFF_SIZE 256
|
||||||
|
|
||||||
#ifndef HAVE_HTONLL
|
#ifndef HAVE_HTONLL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user