Mercurial > hg > release > heapstats-1.0
changeset 33:e99a12f039c6
Bug 1696: The SNMP settings are changed unexpectedly when HeapStats agent reloads the configuration.
reviewed-by: yasuenag
author | KUBOTA Yuji <kubota.yuji@lab.ntt.co.jp> |
---|---|
date | Wed, 12 Mar 2014 18:56:41 +0900 |
parents | a4ee61f4ba79 |
children | 48dc7c3ceee5 |
files | agent/src/trapSender.hpp agent/src/util.cpp |
diffstat | 2 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/agent/src/trapSender.hpp Mon Mar 03 18:11:40 2014 +0900 +++ b/agent/src/trapSender.hpp Wed Mar 12 18:56:41 2014 +0900 @@ -1,7 +1,7 @@ /*! * \file trapSender.hpp * \brief This file is used to send SNMP trap. - * Copyright (C) 2011-2013 Nippon Telegraph and Telephone Corporation + * Copyright (C) 2011-2014 Nippon Telegraph and Telephone Corporation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -189,9 +189,9 @@ memset(&session, 0, sizeof(netsnmp_session)); snmp_sess_init(&session); session.version = snmp; - session.peername = pPeer; + session.peername = strdup(pPeer); session.remote_port = port; - session.community = (u_char*)pCommName; + session.community = (u_char*)strdup(pCommName); session.community_len = (pCommName != NULL) ? strlen(pCommName) : 0 ; @@ -217,7 +217,7 @@ if (pPdu != NULL) { snmp_free_pdu(pPdu); } - /* Close SNMP session. */ + /* Close and free SNMP session. */ snmp_close(&session); /* Unlock to use in multi-thread. */
--- a/agent/src/util.cpp Mon Mar 03 18:11:40 2014 +0900 +++ b/agent/src/util.cpp Wed Mar 12 18:56:41 2014 +0900 @@ -1,7 +1,7 @@ /*! * \file util.cpp * \brief This file is utilities. - * Copyright (C) 2011-2013 Nippon Telegraph and Telephone Corporation + * Copyright (C) 2011-2014 Nippon Telegraph and Telephone Corporation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -226,11 +226,17 @@ newArg->logSignalNormal = oldArg->logSignalNormal; newArg->logSignalAll = oldArg->logSignalAll; newArg->reloadSignal = oldArg->reloadSignal; + newArg->snmpSend &= oldArg->snmpSend; + newArg->snmpTarget = oldArg->snmpTarget; + newArg->snmpComName = oldArg->snmpComName; /* Swap setting. */ oldArg->logSignalNormal = swapArg.logSignalNormal; oldArg->logSignalAll = swapArg.logSignalAll; oldArg->reloadSignal = swapArg.reloadSignal; + oldArg->snmpSend &= swapArg.snmpSend; + oldArg->snmpTarget = swapArg.snmpTarget; + oldArg->snmpComName = swapArg.snmpComName; if(newArg->attach && (!oldArg->attach)){ /* Reset collected flag. */