mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-06 03:45:26 +00:00
Enlarged buffer for JSON deseriealization
This commit is contained in:
parent
54ceed49e8
commit
4d009978eb
2 changed files with 5 additions and 5 deletions
|
|
@ -130,7 +130,7 @@ class Host : public GenericHost {
|
|||
void incHitter(Host *peer, u_int64_t sent_bytes, u_int64_t rcvd_bytes);
|
||||
void updateHostTrafficPolicy(char *key);
|
||||
char* serialize();
|
||||
bool deserialize(char *json_str);
|
||||
bool deserialize(char *json_str, char *key);
|
||||
bool addIfMatching(lua_State* vm, patricia_tree_t * ptree, char *key);
|
||||
void updateSynFlags(time_t when, u_int8_t flags, Flow *f, bool syn_sent);
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ void Host::initialize(u_int8_t mac[6], u_int16_t _vlanId, bool init_all) {
|
|||
|
||||
if(init_all) {
|
||||
if(ip) {
|
||||
char buf[64], host[96], json[4096];
|
||||
char buf[64], host[96], json[8192];
|
||||
|
||||
snprintf(host, sizeof(host), "%s@%u", ip->print(buf, sizeof(buf)), vlan_id);
|
||||
|
||||
|
|
@ -189,7 +189,7 @@ void Host::initialize(u_int8_t mac[6], u_int16_t _vlanId, bool init_all) {
|
|||
/* Found saved copy of the host so let's start from the previous state */
|
||||
// ntop->getTrace()->traceEvent(TRACE_NORMAL, "%s => %s", redis_key, json);
|
||||
ntop->getTrace()->traceEvent(TRACE_INFO, "Deserializing %s", redis_key);
|
||||
deserialize(json);
|
||||
deserialize(json, redis_key);
|
||||
}
|
||||
|
||||
if(localHost || systemHost
|
||||
|
|
@ -876,11 +876,11 @@ bool Host::addIfMatching(lua_State* vm, patricia_tree_t *ptree, char *key) {
|
|||
|
||||
/* *************************************** */
|
||||
|
||||
bool Host::deserialize(char *json_str) {
|
||||
bool Host::deserialize(char *json_str, char *key) {
|
||||
json_object *o, *obj;
|
||||
|
||||
if((o = json_tokener_parse(json_str)) == NULL) {
|
||||
ntop->getTrace()->traceEvent(TRACE_WARNING, "JSON Parse error: %s", json_str);
|
||||
ntop->getTrace()->traceEvent(TRACE_WARNING, "JSON Parse error [key: %s]: %s", key, json_str);
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue