Fixes flow exporter filtering

Fixes #4033
This commit is contained in:
Simone Mainardi 2020-06-12 10:59:20 +02:00
parent f5ef8f8a15
commit d481465e72
3 changed files with 7 additions and 21 deletions

View file

@ -637,15 +637,9 @@ class Flow : public GenericHashEntry {
+((float)(serverNwLatency.tv_usec + clientNwLatency.tv_usec)) / (float)1000000;
}
inline void setFlowApplLatency(float latency_msecs) { applLatencyMsec = latency_msecs; }
inline bool setFlowDevice(u_int32_t device_ip, u_int16_t inidx, u_int16_t outidx) {
if((flow_device.device_ip > 0 && flow_device.device_ip != device_ip)
|| (flow_device.in_index > 0 && flow_device.in_index != inidx)
|| (flow_device.out_index > 0 && flow_device.out_index != outidx))
return false;
if(device_ip) flow_device.device_ip = device_ip;
if(inidx) flow_device.in_index = inidx;
if(outidx) flow_device.out_index = outidx;
return true;
inline void setFlowDevice(u_int32_t device_ip, u_int16_t inidx, u_int16_t outidx) {
flow_device.device_ip = device_ip;
flow_device.in_index = inidx, flow_device.out_index = outidx;
}
inline u_int32_t getFlowDeviceIp() { return flow_device.device_ip; };
inline u_int16_t getFlowDeviceInIndex() { return flow_device.in_index; };

View file

@ -3343,7 +3343,7 @@ static bool flow_matches(Flow *f, struct flowHostRetriever *retriever) {
u_int32_t asn_filter;
char* username_filter;
char* pidname_filter;
u_int32_t deviceIP;
u_int32_t deviceIP = 0;
u_int16_t inIndex, outIndex;
u_int8_t icmp_type, icmp_code;
#ifdef NTOPNG_PRO

View file

@ -236,17 +236,9 @@ void ParserInterface::processFlow(ParsedFlow *zflow) {
flow->updateSeen();
}
/* Update flow device stats */
if(!flow->setFlowDevice(zflow->device_ip,
src2dst_direction ? zflow->inIndex : zflow->outIndex,
src2dst_direction ? zflow->outIndex : zflow->inIndex)) {
static bool flow_device_already_set = false;
if(!flow_device_already_set) {
ntop->getTrace()->traceEvent(TRACE_WARNING, "A flow has been seen from multiple exporters or from "
"multiple IN/OUT interfaces. Check exporters configuration.");
flow_device_already_set = true;
}
}
flow->setFlowDevice(zflow->device_ip,
src2dst_direction ? zflow->inIndex : zflow->outIndex,
src2dst_direction ? zflow->outIndex : zflow->inIndex);
#ifdef MAC_DEBUG
char bufm1[32], bufm2[32];