diff --git a/include/Flow.h b/include/Flow.h index 6f1d59b44f..d373ebbd03 100644 --- a/include/Flow.h +++ b/include/Flow.h @@ -83,10 +83,6 @@ class Flow : public GenericHashEntry { good_low_flow_detected, good_ssl_hs; u_int16_t diff_num_http_requests; #ifdef NTOPNG_PRO - struct { - struct { int cli, srv; } src2dst; - struct { int cli, srv; } dst2src; - } flow_shapers; FlowProfile *trafficProfile; CounterTrend throughputTrend, goodputTrend, thptRatioTrend; #endif @@ -195,7 +191,6 @@ class Flow : public GenericHashEntry { } FlowStatus getFlowStatus(); char* printTCPflags(u_int8_t flags, char *buf, u_int buf_len); - void updateFlowShapers(); inline bool isProtoSSL(u_int16_t p ) { return((ndpi_get_lower_proto(ndpiDetectedProtocol) == p) ? true : false); } inline bool isSSL() { return(isProtoSSL(NDPI_PROTOCOL_SSL)); } inline bool isDNS() { return(isProtoSSL(NDPI_PROTOCOL_DNS)); } @@ -353,7 +348,7 @@ class Flow : public GenericHashEntry { void setDumpFlowTraffic(bool what) { dump_flow_traffic = what; } bool getDumpFlowTraffic(void) { return dump_flow_traffic; } #ifdef NTOPNG_PRO - void getFlowShapers(bool src2dst_direction, int *a_shaper_id, int *b_shaper_id, int *c_shaper_id, int *d_shaper_id); + void getFlowShapers(bool src2dst_direction, int *a_shaper_id, int *b_shaper_id); inline void updateProfile() { trafficProfile = iface->getFlowProfile(this); } inline char* get_profile_name() { return(trafficProfile ? trafficProfile->getName() : (char*)"");} #endif @@ -397,7 +392,7 @@ class Flow : public GenericHashEntry { return false; } - + }; #endif /* _FLOW_H_ */ diff --git a/include/Host.h b/include/Host.h index 125743115b..2f1fc60d2f 100644 --- a/include/Host.h +++ b/include/Host.h @@ -55,7 +55,7 @@ class Host : public GenericHost { TrafficStats icmp_sent, icmp_rcvd; TrafficStats other_ip_sent, other_ip_rcvd; TrafficStats ingress_drops, egress_drops; - + UserActivityStats *user_activities; InterFlowActivityStats *ifa_stats; PacketStats sent_stats, recv_stats; @@ -70,8 +70,6 @@ class Host : public GenericHost { #ifdef NTOPNG_PRO NDPI_PROTOCOL_BITMASK *l7Policy; - char l7Network[MAX_L7_NETWORK_NAME]; - int l7NetworkIndex; #endif struct { @@ -87,7 +85,7 @@ class Host : public GenericHost { void loadFlowsAlertPrefs(void); void getSites(lua_State* vm, char *k, const char *label); void readDHCPCache(); - + public: Host(NetworkInterface *_iface); Host(NetworkInterface *_iface, char *ipAddress, u_int16_t _vlanId); @@ -129,7 +127,7 @@ class Host : public GenericHost { inline bool isPrivateHost() { return(ip.isPrivateAddress()); } inline float get_latitude() { return(latitude); } inline float get_longitude() { return(longitude); } - bool isLocalInterfaceAddress(); + bool isLocalInterfaceAddress(); char* get_name(char *buf, u_int buf_len, bool force_resolution_if_not_found); inline char* get_string_key(char *buf, u_int buf_len) { return(ip.print(buf, buf_len)); }; bool idle(); @@ -195,11 +193,6 @@ class Host : public GenericHost { void incIfaPackets(InterFlowActivityProtos proto, const Flow * flow, time_t when); void getIfaStats(InterFlowActivityProtos proto, time_t when, int * count, u_int32_t * packets, time_t * max_diff); inline UserActivityStats* get_user_activities() { return(user_activities); } -#ifdef NTOPNG_PRO - inline bool isThereAPolicySet() { return(l7Policy ? true : false); }; - inline int getL7NetworkIndex () { return(l7NetworkIndex); }; - inline void updateL7NetworkIndex() { l7NetworkIndex = getInterface()->getL7Policer()->precalculateNetworkIndex(l7Network); }; -#endif inline u_int32_t getNumOutgoingFlows() { return(num_active_flows_as_client); } inline u_int32_t getNumIncomingFlows() { return(num_active_flows_as_server); } static void splitHostVlan(const char *at_sign_str, char*buf, int bufsize, u_int16_t *vlan_id); diff --git a/include/NetworkInterface.h b/include/NetworkInterface.h index 3706e329c2..0824c98ceb 100644 --- a/include/NetworkInterface.h +++ b/include/NetworkInterface.h @@ -229,7 +229,7 @@ class NetworkInterface { pktStats.incStats(pkt_len); if(lastSecUpdate == 0) lastSecUpdate = when; else if(lastSecUpdate != when) updateSecondTraffic(when); }; - + inline void incLocalStats(u_int num_pkts, u_int pkt_len, bool localsender, bool localreceiver) { localStats.incStats(num_pkts, pkt_len, localsender, localreceiver); @@ -345,8 +345,8 @@ class NetworkInterface { inline bool getRefreshAlertCounters() { return refreshAlertCounters; } void listHTTPHosts(lua_State *vm, char *key); #ifdef NTOPNG_PRO - void refreshL7Rules(bool areWeRemovingRules); - void refreshShapers(bool areWeRemovingShapers); + void refreshL7Rules(patricia_tree_t *ptree); + void refreshShapers(); inline L7Policer* getL7Policer() { return(policer); } #endif @@ -354,8 +354,8 @@ class NetworkInterface { PacketDumperTuntap *getPacketDumperTap(void) { return pkt_dumper_tap; } #ifdef NTOPNG_PRO - void updateHostsL7Policy(patricia_tree_t *ptree[MAX_NUM_VLAN]); - void updateFlowsL7Policy(patricia_tree_t *ptree[MAX_NUM_VLAN]); + void updateHostsL7Policy(patricia_tree_t *ptree); + void updateFlowsL7Policy(patricia_tree_t *ptree); #endif bool updateDumpAllTrafficPolicy(void); @@ -393,8 +393,8 @@ class NetworkInterface { void updateFlowProfiles(char *old_profile, char *new_profile); inline FlowProfile* getFlowProfile(Flow *f) { return(flow_profiles ? flow_profiles->getFlowProfile(f) : NULL); } inline bool checkProfileSyntax(char *filter) { return(flow_profiles ? flow_profiles->checkProfileSyntax(filter) : false); } - - bool passShaperPacket(int a_shaper_id, int b_shaper_id, int c_shaper_id, int d_shaper_id, struct pcap_pkthdr *h); + + bool passShaperPacket(int a_shaper_id, int b_shaper_id, struct pcap_pkthdr *h); void initL7Policer(); #endif void setRemoteStats(char *name, char *address, u_int32_t speedMbit, diff --git a/src/Flow.cpp b/src/Flow.cpp index a84edc8078..c0cd8b1c81 100644 --- a/src/Flow.cpp +++ b/src/Flow.cpp @@ -97,7 +97,6 @@ Flow::Flow(NetworkInterface *_iface, last_update_time.tv_sec = (long)first_seen; #ifdef NTOPNG_PRO - flow_shapers.src2dst.cli = flow_shapers.src2dst.srv = flow_shapers.dst2src.cli = flow_shapers.dst2src.srv = -1; trafficProfile = NULL; #endif @@ -542,9 +541,6 @@ void Flow::setDetectedProtocol(ndpi_protocol proto_id, bool forceDetection) { } if(detection_completed) { -#ifdef NTOPNG_PRO - updateFlowShapers(); -#endif iface->luaEvalFlow(this, callback_flow_proto_callback); } @@ -778,22 +774,6 @@ bool Flow::dumpFlow(bool partial_dump) { /* *************************************** */ -#ifdef NTOPNG_PRO -void Flow::updateFlowShapers() { - L7Policer *policer = iface->getL7Policer(); - - if(cli_host && srv_host && policer) { - flow_shapers.src2dst.cli = policer->getShaperIdForProtocol(cli_host->getL7NetworkIndex(), ndpiDetectedProtocol.protocol, L7_POLICY_DIRECTION_INGRESS); - flow_shapers.src2dst.srv = policer->getShaperIdForProtocol(srv_host->getL7NetworkIndex(), ndpiDetectedProtocol.protocol, L7_POLICY_DIRECTION_EGRESS); - flow_shapers.dst2src.cli = policer->getShaperIdForProtocol(cli_host->getL7NetworkIndex(), ndpiDetectedProtocol.protocol, L7_POLICY_DIRECTION_EGRESS); - flow_shapers.dst2src.srv = policer->getShaperIdForProtocol(srv_host->getL7NetworkIndex(), ndpiDetectedProtocol.protocol, L7_POLICY_DIRECTION_INGRESS); - } else - flow_shapers.src2dst.cli = flow_shapers.src2dst.srv = flow_shapers.dst2src.cli = flow_shapers.dst2src.srv = -1; -} -#endif - -/* *************************************** */ - void Flow::update_hosts_stats(struct timeval *tv, bool inDeleteMethod) { u_int64_t sent_packets, sent_bytes, sent_goodput_bytes, rcvd_packets, rcvd_bytes, rcvd_goodput_bytes; u_int64_t diff_sent_packets, diff_sent_bytes, diff_sent_goodput_bytes, @@ -1200,7 +1180,7 @@ void Flow::lua(lua_State* vm, patricia_tree_t * ptree, lua_push_str_table_entry(vm, "cli.host", src->get_name(buf, sizeof(buf), false)); lua_push_int_table_entry(vm, "cli.source_id", src->getSourceId()); lua_push_str_table_entry(vm, "cli.mac", Utils::formatMac(src->get_mac(), buf, sizeof(buf))); - + lua_push_bool_table_entry(vm, "cli.systemhost", src->isSystemHost()); lua_push_bool_table_entry(vm, "cli.allowed_host", src_match); lua_push_int32_table_entry(vm, "cli.network_id", src->get_local_network_id()); @@ -1320,22 +1300,18 @@ void Flow::lua(lua_State* vm, patricia_tree_t * ptree, #ifdef NTOPNG_PRO /* Shapers */ if(cli_host && srv_host) { - int a, b, c, d; + int a, b; - getFlowShapers(true, &a, &b, &c, &d); + getFlowShapers(true, &a, &b); lua_push_int_table_entry(vm, "shaper.cli2srv_a", a); lua_push_int_table_entry(vm, "shaper.cli2srv_b", b); - lua_push_int_table_entry(vm, "shaper.cli2srv_c", c); - lua_push_int_table_entry(vm, "shaper.cli2srv_d", d); - getFlowShapers(false, &a, &b, &c, &d); + getFlowShapers(false, &a, &b); lua_push_int_table_entry(vm, "shaper.srv2cli_a", a); lua_push_int_table_entry(vm, "shaper.srv2cli_b", b); - lua_push_int_table_entry(vm, "shaper.srv2cli_c", c); - lua_push_int_table_entry(vm, "shaper.srv2cli_d", d); } #endif - + if(isHTTP() && protos.http.last_method && protos.http.last_url) lua_push_str_table_entry(vm, "protos.http.last_url", protos.http.last_url); @@ -2373,18 +2349,15 @@ void Flow::checkFlowCategory() { #ifdef NTOPNG_PRO void Flow::getFlowShapers(bool src2dst_direction, - int *a_shaper_id, int *b_shaper_id, - int *c_shaper_id, int *d_shaper_id) { + int *a_shaper_id, int *b_shaper_id) { if(cli_host && srv_host) { if(src2dst_direction) { - *a_shaper_id = cli_host->get_egress_shaper_id(), *b_shaper_id = srv_host->get_ingress_shaper_id(), - *c_shaper_id = flow_shapers.src2dst.cli, *d_shaper_id = flow_shapers.src2dst.srv; + *a_shaper_id = cli_host->get_egress_shaper_id(), *b_shaper_id = srv_host->get_ingress_shaper_id(); } else { - *a_shaper_id = cli_host->get_ingress_shaper_id(), *b_shaper_id = srv_host->get_egress_shaper_id(), - *c_shaper_id = flow_shapers.dst2src.cli, *d_shaper_id = flow_shapers.dst2src.srv; + *a_shaper_id = cli_host->get_ingress_shaper_id(), *b_shaper_id = srv_host->get_egress_shaper_id(); } } else - *a_shaper_id = *b_shaper_id = *c_shaper_id = *d_shaper_id = -1; + *a_shaper_id = *b_shaper_id = -1; } #endif @@ -2426,7 +2399,7 @@ void Flow::dissectSSL(u_int8_t *payload, u_int16_t payload_len, const struct bpf if((cli2srv && (getSSLEncryptionStatus() & SSL_ENCRYPTION_CLIENT)) || (!cli2srv && (getSSLEncryptionStatus() & SSL_ENCRYPTION_SERVER)) ) { protos.ssl.is_data = true; - + if(!protos.ssl.firstdata_seen) { if(getSSLEncryptionStatus() == SSL_ENCRYPTION_BOTH) { memcpy(&protos.ssl.lastdata_time, when, sizeof(struct timeval)); @@ -2489,7 +2462,7 @@ void Flow::dissectSSL(u_int8_t *payload, u_int16_t payload_len, const struct bpf - Utils::timeval2usec(&protos.ssl.clienthello_time)))/1000; // iface->luaEvalFlow(this, callback_flow_proto_callback); } - + protos.ssl.hs_packets++; good_ssl_hs &= protos.ssl.hs_packets <= SSL_MAX_HANDSHAKE_PCKS; } @@ -2589,4 +2562,3 @@ bool Flow::invokeActivityFilter(const struct timeval *when, } /* ***************************************************** */ - diff --git a/src/Host.cpp b/src/Host.cpp index 99cea8b749..0c8daa4143 100644 --- a/src/Host.cpp +++ b/src/Host.cpp @@ -248,8 +248,7 @@ void Host::initialize(u_int8_t _mac[6], u_int16_t _vlanId, bool init_all) { } #ifdef NTOPNG_PRO - l7Policy = NULL, l7NetworkIndex = -1; - memset(l7Network, 0, sizeof(l7Network)); + l7Policy = NULL; #endif loadAlertPrefs(); @@ -319,15 +318,14 @@ void Host::updateHostL7Policy() { if(ntop->getPro()->has_valid_license()) { if(localHost || systemHost) { - char hash_name[64], rsp[32]; + char host_key[64], hash_name[64], rsp[32]; char buf[64], *host; u_int8_t bitmask; l7Policy = getInterface()->getL7Policer()->getIpPolicy(&ip, vlan_id, &bitmask); host = ip.print(buf, sizeof(buf), bitmask); - snprintf(l7Network, sizeof(l7Network), "%s/%u@%u", host, - bitmask, vlan_id); + snprintf(host_key, sizeof(host_key), "%s/%u@%u", host, bitmask, vlan_id); /* ************************************************* */ @@ -335,8 +333,8 @@ void Host::updateHostL7Policy() { "ntopng.prefs.%u.l7_policy_ingress_shaper_id", getInterface()->get_id()); - if((ntop->getRedis()->hashGet(hash_name, l7Network, rsp, sizeof(rsp)) != 0) - || (rsp[0] == '\0')) + if((ntop->getRedis()->hashGet(hash_name, host_key, rsp, sizeof(rsp)) != 0) + || (rsp[0] == '\0')) ingress_shaper_id = -1; else { ingress_shaper_id = atoi(rsp); @@ -351,8 +349,8 @@ void Host::updateHostL7Policy() { "ntopng.prefs.%u.l7_policy_egress_shaper_id", getInterface()->get_id()); - if((ntop->getRedis()->hashGet(hash_name, l7Network, rsp, sizeof(rsp)) != 0) - || (rsp[0] == '\0')) + if((ntop->getRedis()->hashGet(hash_name, host_key, rsp, sizeof(rsp)) != 0) + || (rsp[0] == '\0')) egress_shaper_id = -1; else { egress_shaper_id = atoi(rsp); @@ -361,17 +359,14 @@ void Host::updateHostL7Policy() { egress_shaper_id = -1; } /* - char name[256]; printf("%s -> %s - %d %d\n", + char name[256]; printf("%s -> %s - %d %d\n", get_name(name, sizeof(name), false), l7Network, ingress_shaper_id, egress_shaper_id); */ } else { l7Policy = NULL; - memset(l7Network, 0, sizeof(l7Network)); ingress_shaper_id = egress_shaper_id = -1; } - /* cache l7 network ID to speedup per packet access */ - updateL7NetworkIndex(); } #endif } @@ -718,7 +713,7 @@ char* Host::get_name(char *buf, u_int buf_len, bool force_resolution_if_not_foun readDHCPCache(); if(symbolic_name) return(symbolic_name); - + rc = ntop->getRedis()->getAddress(addr, redis_buf, sizeof(redis_buf), force_resolution_if_not_found); diff --git a/src/Lua.cpp b/src/Lua.cpp index 1b0a8ad4d3..b3d64f1789 100644 --- a/src/Lua.cpp +++ b/src/Lua.cpp @@ -854,12 +854,12 @@ static int ntop_swapHostBlacklist(lua_State* vm) { static int ntop_addToHostBlacklist(lua_State* vm) { char *net; - + ntop->getTrace()->traceEvent(TRACE_DEBUG, "%s() called", __FUNCTION__); if(ntop_lua_check(vm, __FUNCTION__, 1, LUA_TSTRING)) return(CONST_LUA_ERROR); net = (char*)lua_tostring(vm, 1); - + ntop->addToHostBlacklist(net); lua_pushnil(vm); return(CONST_LUA_OK); @@ -2529,7 +2529,7 @@ static int ntop_rrd_lastupdate(lua_State* vm) { static int __ntop_rrd_args (lua_State* vm, char **filename, char **cf, time_t *start, time_t *end) { char *start_s, *end_s, *err; rrd_time_value_t start_tv, end_tv; - + if(ntop_lua_check(vm, __FUNCTION__, 1, LUA_TSTRING)) return(CONST_LUA_PARAM_ERROR); if((*filename = (char*)lua_tostring(vm, 1)) == NULL) return(CONST_LUA_PARAM_ERROR); @@ -2564,7 +2564,7 @@ static int __ntop_rrd_args (lua_State* vm, char **filename, char **cf, time_t *s static int __ntop_rrd_status(lua_State* vm, int status, char *filename, char *cf) { char * err; - + if(status != 0) { err = rrd_get_error(); @@ -2664,7 +2664,7 @@ static int ntop_rrd_fetch_columns(lua_State* vm) { char **names; unsigned long step = 0, ds_cnt = 0; rrd_value_t *data, *p; - + if ((status = __ntop_rrd_args(vm, &filename, &cf, &start, &end)) != CONST_LUA_OK) return status; ntop->getTrace()->traceEvent(TRACE_INFO, "%s(%s)", __FUNCTION__, filename); @@ -2698,7 +2698,7 @@ static int ntop_rrd_fetch_columns(lua_State* vm) { lua_setfield(vm, -2, names[i]); rrd_freemem(names[i]); } - + rrd_freemem(names); rrd_freemem(data); @@ -3132,7 +3132,7 @@ static int ntop_reload_l7_rules(lua_State *vm) { } #ifdef NTOPNG_PRO - ntop_interface->refreshL7Rules(ptree ? true : false); + ntop_interface->refreshL7Rules(ptree); #endif if (ptree) @@ -3144,37 +3144,14 @@ static int ntop_reload_l7_rules(lua_State *vm) { /* ****************************************** */ -static int ntop_reload_l7_proto_rules(lua_State *vm) { - NetworkInterface *ntop_interface = getCurrentInterface(vm); - ntop->getTrace()->traceEvent(TRACE_DEBUG, "%s() called", __FUNCTION__); - - if(ntop_interface) { -#ifdef NTOPNG_PRO - if (ntop_interface->getL7Policer()) { - ntop_interface->getL7Policer()->refreshProtocolShapers(); - return(CONST_LUA_OK); - } -#endif - } - return(CONST_LUA_ERROR); -} - -/* ****************************************** */ - static int ntop_reload_shapers(lua_State *vm) { NetworkInterface *ntop_interface = getCurrentInterface(vm); - char *shaper_id = NULL; ntop->getTrace()->traceEvent(TRACE_DEBUG, "%s() called", __FUNCTION__); if(ntop_interface) { - /* You should pass the shaper ID whenever a shaper is removed */ - if(lua_type(vm, 1) == LUA_TSTRING) { - shaper_id = (char*)lua_tostring(vm, 1); - if(shaper_id == NULL) return(CONST_LUA_PARAM_ERROR); - } #ifdef NTOPNG_PRO - ntop_interface->refreshShapers(shaper_id != NULL ? true : false); + ntop_interface->refreshShapers(); #endif return(CONST_LUA_OK); } else @@ -4426,7 +4403,7 @@ static int ntop_interface_get_alerts(lua_State* vm) { return(CONST_LUA_ERROR); ap->readOptions(vm, 1); - + if(ntop_lua_check(vm, __FUNCTION__, 2, LUA_TBOOLEAN)) return(CONST_LUA_ERROR); engaged = lua_toboolean(vm, 2); @@ -4494,9 +4471,9 @@ static int ntop_interface_get_flow_alerts(lua_State* vm) { return(CONST_LUA_ERROR); ap->readOptions(vm, 1); - + return am->getFlowAlerts(vm, get_allowed_nets(vm), ap) ? CONST_LUA_ERROR : CONST_LUA_OK; - + } else { if(ntop_lua_check(vm, __FUNCTION__, 1, LUA_TNUMBER)) return(CONST_LUA_ERROR); start_idx = (u_int32_t)lua_tonumber(vm, 1); @@ -5328,7 +5305,6 @@ static const luaL_Reg ntop_interface_reg[] = { /* L7 */ { "reloadL7Rules", ntop_reload_l7_rules }, - { "reloadL7ProtoRules", ntop_reload_l7_proto_rules }, { "reloadShapers", ntop_reload_shapers }, /* DB */ @@ -5886,7 +5862,7 @@ int Lua::handle_script_request(struct mg_connection *conn, if((ntop->getRedis()->get(decoded_buf, rsp, sizeof(rsp)) == -1) || (strcmp(rsp, user) != 0)) { const char *msg = "The submitted form is expired. Please reload the page and try again"; - + ntop->getTrace()->traceEvent(TRACE_WARNING, "Invalid CSRF parameter specified [%s][%s][%s][%s]: page expired?", decoded_buf, rsp, user, tok); diff --git a/src/NetworkInterface.cpp b/src/NetworkInterface.cpp index c1d6826876..8723a3aa40 100644 --- a/src/NetworkInterface.cpp +++ b/src/NetworkInterface.cpp @@ -1219,14 +1219,14 @@ bool NetworkInterface::processPacket(const struct bpf_timeval *when, #ifdef NTOPNG_PRO if(is_bridge_interface() && pass_verdict) { - int a_shaper_id, b_shaper_id, c_shaper_id, d_shaper_id; + int a_shaper_id, b_shaper_id; char buf[64]; - flow->getFlowShapers(src2dst_direction, &a_shaper_id, &b_shaper_id, &c_shaper_id, &d_shaper_id); - ntop->getTrace()->traceEvent(TRACE_NORMAL, "[%s] %d / %d / %d / %d", + flow->getFlowShapers(src2dst_direction, &a_shaper_id, &b_shaper_id); + ntop->getTrace()->traceEvent(TRACE_NORMAL, "[%s] %d / %d ", flow->get_detected_protocol_name(buf, sizeof(buf)), - a_shaper_id, b_shaper_id, c_shaper_id, d_shaper_id); - pass_verdict = passShaperPacket(a_shaper_id, b_shaper_id, c_shaper_id, d_shaper_id, (struct pcap_pkthdr*)h); + a_shaper_id, b_shaper_id); + pass_verdict = passShaperPacket(a_shaper_id, b_shaper_id, (struct pcap_pkthdr*)h); } #endif @@ -1841,15 +1841,12 @@ void NetworkInterface::periodicStatsUpdate() { /* **************************************************** */ #ifdef NTOPNG_PRO + static bool update_host_l7_policy(GenericHashEntry *node, void *user_data) { Host *h = (Host*)node; - patricia_tree_t **ptree = (patricia_tree_t**)user_data; - patricia_tree_t *v_ptree = ptree[h->get_vlan_id()]; + patricia_tree_t *ptree = (patricia_tree_t*)user_data; - if((ptree == NULL) - || h->isThereAPolicySet() /* As we have changed the policer, we need to do this update - for all hosts that used to have a policy set */ - || (v_ptree && h->match(ptree[h->get_vlan_id()]))) + if((ptree == NULL) || h->match(ptree)) ((Host*)node)->updateHostL7Policy(); return(false); /* false = keep on walking */ @@ -1857,28 +1854,20 @@ static bool update_host_l7_policy(GenericHashEntry *node, void *user_data) { /* **************************************************** */ -void NetworkInterface::updateHostsL7Policy(patricia_tree_t *ptree[MAX_NUM_VLAN]) { +void NetworkInterface::updateHostsL7Policy(patricia_tree_t *ptree) { if(isView()) return; - hosts_hash->walk(update_host_l7_policy, ptree); } /* **************************************************** */ static bool update_flow_l7_policy(GenericHashEntry *node, void *user_data) { - patricia_tree_t **ptree = (patricia_tree_t**)user_data; + patricia_tree_t *ptree = (patricia_tree_t*)user_data; Flow *f = (Flow*)node; - patricia_tree_t *v_ptree = (ptree && f->get_cli_host()) ? ptree[f->get_cli_host()->get_vlan_id()] : NULL; - /* - As we have changed the policer, we need to do this update - for all hosts that used to have a policy set - */ - if((f->get_cli_host() - && (f->get_cli_host()->isThereAPolicySet() || (v_ptree && f->get_cli_host()->match(v_ptree)))) - || (f->get_srv_host() - && (f->get_srv_host()->isThereAPolicySet() || (v_ptree && f->get_srv_host()->match(v_ptree)))) - ) + if((ptree == NULL) + || (f->get_cli_host() && f->get_cli_host()->match(ptree)) + || (f->get_srv_host() && f->get_srv_host()->match(ptree))) ((Flow*)node)->makeVerdict(true); return(false); /* false = keep on walking */ @@ -1886,7 +1875,7 @@ static bool update_flow_l7_policy(GenericHashEntry *node, void *user_data) { /* **************************************************** */ -void NetworkInterface::updateFlowsL7Policy(patricia_tree_t *ptree[MAX_NUM_VLAN]) { +void NetworkInterface::updateFlowsL7Policy(patricia_tree_t *ptree) { if(isView()) return; flows_hash->walk(update_flow_l7_policy, ptree); @@ -3822,18 +3811,18 @@ void NetworkInterface::addAllAvailableInterfaces() { /* **************************************** */ #ifdef NTOPNG_PRO -void NetworkInterface::refreshL7Rules(bool areWeRemovingRules) { +void NetworkInterface::refreshL7Rules(patricia_tree_t *ptree) { if(ntop->getPro()->has_valid_license() && policer) - policer->refreshL7Rules(areWeRemovingRules); + policer->refreshL7Rules(ptree); } #endif /* **************************************** */ #ifdef NTOPNG_PRO -void NetworkInterface::refreshShapers(bool areWeRemovingShapers) { +void NetworkInterface::refreshShapers() { if(ntop->getPro()->has_valid_license() && policer) - policer->refreshShapers(areWeRemovingShapers); + policer->refreshShapers(); } #endif diff --git a/third-party/json-c/config.h.in b/third-party/json-c/config.h.in index d9042222aa..b8b2d17ef0 100644 --- a/third-party/json-c/config.h.in +++ b/third-party/json-c/config.h.in @@ -123,6 +123,9 @@ /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME +/* Define to the home page for this package. */ +#undef PACKAGE_URL + /* Define to the version of this package. */ #undef PACKAGE_VERSION