Fix minor issues and compiler warnings

This commit is contained in:
Peter Haag 2017-12-03 15:53:48 +01:00
parent 659f582b97
commit 235fad2e71
5 changed files with 17 additions and 17 deletions

View File

@ -1,5 +1,6 @@
2017-12-03 2017-12-03
- Fix old 1.6.15 tags - Fix old 1.6.15 tags
- Fix minor issues and compiler warnings
2017-10-22 2017-10-22
- Add support for CISCO IOS 8 bytes timestamps ID 21/22 - Add support for CISCO IOS 8 bytes timestamps ID 21/22

View File

@ -467,9 +467,8 @@ void Push_Node(NodeList_t *NodeList, struct FlowNode *node) {
NodeList->last = node; NodeList->last = node;
NodeList->length++; NodeList->length++;
#ifdef DEVEL #ifdef DEVEL
int proto = node->proto;
printf("pushed node 0x%llx proto: %u, length: %u first: %llx, last: %llx\n", printf("pushed node 0x%llx proto: %u, length: %u first: %llx, last: %llx\n",
(unsigned long long)node, proto, NodeList->length, (unsigned long long)NodeList->list, (unsigned long long)NodeList->last); (unsigned long long)node, node->proto, NodeList->length, (unsigned long long)NodeList->list, (unsigned long long)NodeList->last);
ListCheck(NodeList); ListCheck(NodeList);
#endif #endif
if ( NodeList->waiting ) { if ( NodeList->waiting ) {
@ -483,7 +482,6 @@ void Push_Node(NodeList_t *NodeList, struct FlowNode *node) {
struct FlowNode *Pop_Node(NodeList_t *NodeList, int *done) { struct FlowNode *Pop_Node(NodeList_t *NodeList, int *done) {
struct FlowNode *node; struct FlowNode *node;
int proto;
GetTreeLock(NodeList); GetTreeLock(NodeList);
while ( NodeList->length == 0 && !*done ) { while ( NodeList->length == 0 && !*done ) {
@ -522,12 +520,11 @@ int proto;
node->left = NULL; node->left = NULL;
node->right = NULL; node->right = NULL;
proto = node->proto;
NodeList->length--; NodeList->length--;
#ifdef DEVEL #ifdef DEVEL
printf("popped node 0x%llx proto: %u, length: %u first: %llx, last: %llx\n", printf("popped node 0x%llx proto: %u, length: %u first: %llx, last: %llx\n",
(unsigned long long)node, proto, NodeList->length, (unsigned long long)NodeList->list, (unsigned long long)NodeList->last); (unsigned long long)node, node->proto, NodeList->length, (unsigned long long)NodeList->list, (unsigned long long)NodeList->last);
ListCheck(NodeList); ListCheck(NodeList);
#endif #endif

View File

@ -212,12 +212,12 @@ int main( int argc, char **argv ) {
struct stat fstat; struct stat fstat;
int c, err, maxsize_set, maxlife_set; int c, err, maxsize_set, maxlife_set;
int do_rescan, do_expire, do_list, print_stat, do_update_param, print_books, is_profile, nfsen_format; int do_rescan, do_expire, do_list, print_stat, do_update_param, print_books, is_profile, nfsen_format;
char *maxsize_string, *lifetime_string, *datadir; char *lifetime_string, *datadir;
uint64_t maxsize, lifetime, low_water; uint64_t maxsize, lifetime, low_water;
uint32_t runtime; uint32_t runtime;
channel_t *channel, *current_channel; channel_t *channel, *current_channel;
maxsize_string = lifetime_string = NULL; lifetime_string = NULL;
datadir = NULL; datadir = NULL;
maxsize = lifetime = 0; maxsize = lifetime = 0;
do_rescan = 0; do_rescan = 0;

View File

@ -1670,7 +1670,7 @@ uint32_t maxindex, c;
else else
printf("Top flows ordered by %s:\n", order_mode[order_index].string); printf("Top flows ordered by %s:\n", order_mode[order_index].string);
} }
if ( !record_header ) if ( record_header )
printf("%s\n", record_header); printf("%s\n", record_header);
} }
PrintSortedFlowcache(SortList, maxindex, topN, 0, print_record, tag, DESCENDING, extension_map_list); PrintSortedFlowcache(SortList, maxindex, topN, 0, print_record, tag, DESCENDING, extension_map_list);

View File

@ -515,11 +515,17 @@ static inline void readCountersSample_v2v4(SFSample *sample, FlowSource_t *fs);
static inline void StoreSflowRecord(SFSample *sample, FlowSource_t *fs); static inline void StoreSflowRecord(SFSample *sample, FlowSource_t *fs);
extern int verbose;
#ifdef DEVEL #ifdef DEVEL
static inline char *printTag(uint32_t tag, char *buf, int bufLen); static inline char *printTag(uint32_t tag, char *buf, int bufLen);
#endif
extern int verbose; static inline char *printTag(uint32_t tag, char *buf, int bufLen) {
snprintf(buf, bufLen, "%u:%u", (tag >> 12), (tag & 0x00000FFF));
return buf;
} // End of printTag
#endif
/*_________________---------------------------__________________ /*_________________---------------------------__________________
@ -1410,15 +1416,11 @@ static inline uint32_t getAddress(SFSample *sample, SFLAddress *address) {
static inline void skipTLVRecord(SFSample *sample, uint32_t tag, uint32_t len, char *description) { static inline void skipTLVRecord(SFSample *sample, uint32_t tag, uint32_t len, char *description) {
#ifdef DEVEL #ifdef DEVEL
static inline char *printTag(uint32_t tag, char *buf, int bufLen) { char buf[51];
snprintf(buf, bufLen, "%u:%u", (tag >> 12), (tag & 0x00000FFF)); snprintf(buf, 50, "%u:%u", (tag >> 12), (tag & 0x00000FFF));
return buf; printf("skipping unknown %s: 0x%x, %s len=%d\n", description, tag, buf, len);
} // End of printTag
char buf[51];
#endif #endif
dbg_printf("skipping unknown %s: 0x%x, %s len=%d\n", description, tag, printTag(tag, buf, 50), len);
skipBytes(sample, len); skipBytes(sample, len);
} // End of skipTLVRecord } // End of skipTLVRecord