diff --git a/include/NetworkInterface.h b/include/NetworkInterface.h index 15392bce07..84987bc7fe 100644 --- a/include/NetworkInterface.h +++ b/include/NetworkInterface.h @@ -80,7 +80,7 @@ class NetworkInterface { string ip_addresses; int id; - bool bridge_interface, forcePoolReload; + bool bridge_interface, forcePoolReload, isThisASubinteface; #ifdef NTOPNG_PRO L7Policer *policer; FlowProfiles *flow_profiles, *shadow_flow_profiles; @@ -597,6 +597,8 @@ class NetworkInterface { void topProtocolsAdd(u_int16_t pool_id, ndpi_protocol *proto, u_int32_t bytes); inline void luaTopPoolsProtos(lua_State *vm) { frequentProtocols->luaTopPoolsProtocols(vm); } void topMacsAdd(Mac *mac, ndpi_protocol *proto, u_int32_t bytes); + inline bool isSubinterface() { return(isThisASubinteface); } + inline void setSubinterface() { isThisASubinteface = true; } inline void luaTopMacsProtos(lua_State *vm) { frequentMacs->luaTopMacsProtocols(vm); } inline SNMP* getSNMP() { return(snmp); } inline MDNS* getMDNS() { return(mdns); } diff --git a/src/NetworkInterface.cpp b/src/NetworkInterface.cpp index 5ed82f7684..b112d68b39 100644 --- a/src/NetworkInterface.cpp +++ b/src/NetworkInterface.cpp @@ -256,7 +256,7 @@ void NetworkInterface::init() { sprobe_interface = inline_interface = false, has_vlan_packets = false, last_pkt_rcvd = last_pkt_rcvd_remote = 0, next_idle_flow_purge = next_idle_host_purge = 0, - running = false, customIftype = NULL, + running = false, customIftype = NULL, isThisASubinteface = false, numVirtualInterfaces = 0, flowHashing = NULL, pcap_datalink_type = 0, mtuWarningShown = false, purge_idle_flows_hosts = true, id = (u_int8_t)-1, @@ -1041,6 +1041,7 @@ NetworkInterface* NetworkInterface::getSubInterface(u_int32_t criteria, bool par HASH_ADD_INT(flowHashing, criteria, h); ntop->registerInterface(h->iface); numVirtualInterfaces++; + h->iface->setSubinterface(); } } else ntop->getTrace()->traceEvent(TRACE_WARNING, "Not enough memory"); @@ -1093,7 +1094,7 @@ void NetworkInterface::processFlow(ZMQ_Flow *zflow) { #endif } - if(flowHashingMode != flowhashing_none) { + if((!isThisASubinteface) && (flowHashingMode != flowhashing_none)) { NetworkInterface *vIface = NULL; switch(flowHashingMode) { @@ -1359,9 +1360,11 @@ bool NetworkInterface::processPacket(u_int32_t bridge_iface_idx, bool pass_verdict = true; /* VLAN disaggregation */ - if((flowHashingMode == flowhashing_vlan) && (vlan_id > 0)) { + if((!isThisASubinteface) + && (flowHashingMode == flowhashing_vlan) + && (vlan_id > 0)) { NetworkInterface *vIface; - + if((vIface = getSubInterface((u_int32_t)vlan_id, false)) != NULL) { bool ret;