mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-06 03:45:26 +00:00
Implements interface view hosts updates
This commit is contained in:
parent
e2001d69c6
commit
5fcc4986bc
3 changed files with 30 additions and 6 deletions
|
|
@ -215,7 +215,6 @@ class Flow : public GenericHashEntry {
|
|||
void dumpPacketStats(lua_State* vm, bool cli2srv_direction);
|
||||
bool isReadyToBeMarkedAsIdle();
|
||||
bool isBlacklistedFlow() const;
|
||||
u_int16_t getStatsProtocol() const;
|
||||
inline bool isDeviceAllowedProtocol() {
|
||||
return(!cli_host || !srv_host ||
|
||||
((cli_host->getDeviceAllowedProtocolStatus(ndpiDetectedProtocol, true) == device_proto_allowed) &&
|
||||
|
|
@ -309,9 +308,13 @@ class Flow : public GenericHashEntry {
|
|||
void updateSeqNum(time_t when, u_int32_t sN, u_int32_t aN);
|
||||
void processDetectedProtocol();
|
||||
void setDetectedProtocol(ndpi_protocol proto_id, bool forceDetection);
|
||||
void setCustomApp(custom_app_t ca) {
|
||||
inline void setCustomApp(custom_app_t ca) {
|
||||
memcpy(&custom_app, &ca, sizeof(custom_app));
|
||||
};
|
||||
inline custom_app_t getCustomApp() const {
|
||||
return custom_app;
|
||||
};
|
||||
u_int16_t getStatsProtocol() const;
|
||||
void setJSONInfo(const char *json);
|
||||
#ifdef NTOPNG_PRO
|
||||
inline bool is_status_counted_in_aggregated_flow() const { return(status_counted_in_aggregated_flow); };
|
||||
|
|
|
|||
|
|
@ -2439,7 +2439,7 @@ bool Flow::get_partial_traffic_stats(FlowTrafficStats *fts) {
|
|||
if(!fts)
|
||||
return false;
|
||||
|
||||
if(!last_partial && !(last_partial = (FlowTrafficStats*)malloc(sizeof(FlowTrafficStats))))
|
||||
if(!last_partial && !(last_partial = (FlowTrafficStats*)calloc(1, sizeof(FlowTrafficStats))))
|
||||
return false;
|
||||
|
||||
memcpy(&tmp, &stats, sizeof(stats));
|
||||
|
|
|
|||
|
|
@ -293,15 +293,36 @@ void ViewInterface::lua(lua_State *vm) {
|
|||
static bool viewed_flows_walker(GenericHashEntry *flow, void *user_data, bool *matched) {
|
||||
ViewInterface *iface = (ViewInterface*)user_data;
|
||||
Flow *f = (Flow*)flow;
|
||||
time_t now = time(NULL);
|
||||
|
||||
iface->purgeIdle(time(NULL));
|
||||
iface->purgeIdle(now);
|
||||
|
||||
if(f->is_acknowledged_to_purge())
|
||||
return false; /* Already visited for the last time after it has gone idle, keep walking */
|
||||
|
||||
FlowTrafficStats partials;
|
||||
if(f->get_partial_traffic_stats(&partials)) {
|
||||
|
||||
const IpAddress *cli_ip = f->get_cli_ip_addr(), *srv_ip = f->get_srv_ip_addr();
|
||||
|
||||
if(f->get_partial_traffic_stats(&partials) && cli_ip && srv_ip) {
|
||||
Host *cli_host = NULL, *srv_host = NULL;
|
||||
|
||||
iface->findFlowHosts(f->get_vlan_id(),
|
||||
NULL /* no src mac yet */, (IpAddress*)cli_ip, &cli_host,
|
||||
NULL /* no dst mac yet */, (IpAddress*)srv_ip, &srv_host);
|
||||
|
||||
if(cli_host) {
|
||||
cli_host->incStats(now, f->get_protocol(), f->getStatsProtocol(), f->getCustomApp(),
|
||||
partials.cli2srv_packets, partials.cli2srv_bytes, partials.cli2srv_goodput_bytes,
|
||||
partials.srv2cli_packets, partials.srv2cli_bytes, partials.srv2cli_goodput_bytes,
|
||||
cli_ip->isNonEmptyUnicastAddress());
|
||||
}
|
||||
|
||||
if(srv_host) {
|
||||
srv_host->incStats(now, f->get_protocol(), f->getStatsProtocol(), f->getCustomApp(),
|
||||
partials.srv2cli_packets, partials.srv2cli_bytes, partials.srv2cli_goodput_bytes,
|
||||
partials.cli2srv_packets, partials.cli2srv_bytes, partials.cli2srv_goodput_bytes,
|
||||
srv_ip->isNonEmptyUnicastAddress());
|
||||
}
|
||||
}
|
||||
|
||||
/* The flow has already been marked as idle by the underlying viewed interface,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue