[AGENT++] SnmpTagValue does'nt accept empty string
s S
getlaser at gmail.com
Wed Feb 18 13:32:22 CET 2015
Hi,
Objects of type SnmpTagValue should accept values in the range 0 – 255
according to RFC http://www.ietf.org/rfc/rfc2573.txt. In Agent++ when an
object of type SnmpTagValue is given empty string it doesn’t work.
E.g:
snmpset -v2c -c public <ip-addr>
1.3.6.1.6.3.18.1.1.1.8.112.114.105.118.97.116.101 i 4
1.3.6.1.6.3.18.1.1.1.2.112.114.105.118.97.116.101 s "private"
1.3.6.1.6.3.18.1.1.1.3.112.114.105.118.97.116.101 s "private"
1.3.6.1.6.3.18.1.1.1.4.112.114.105.118.97.116.101 x 800054C0054919604171
1.3.6.1.6.3.18.1.1.1.6.112.114.105.118.97.116.101 s ""
1.3.6.1.6.3.18.1.1.1.7.112.114.105.118.97.116.101 i 3
Error in packet.
Reason: wrongLength (The set value has an illegal length from what the
agent expects)
Failed object: SNMP-COMMUNITY-MIB::snmpCommunityTransportTag.'private'
The fix for this issue is
Index: snmp_textual_conventions.cpp
===================================================================
--- snmp_textual_conventions.cpp (revision 9127)
+++ snmp_textual_conventions.cpp (working copy)
@@ -278,7 +278,7 @@
Vbx vb(req->get_value(ind));
if (vb.get_value(ostr) != SNMP_CLASS_SUCCESS)
return SNMP_ERROR_WRONG_TYPE;
- if ((ostr.len()<= 0) || (ostr.len() > 255))
+ if ((ostr.len()< 0) || (ostr.len() > 255))
return SNMP_ERROR_WRONG_LENGTH;
return SNMP_ERROR_SUCCESS;
}
Btw the check for tag length is done correctly in the function bool
SnmpTagValue::value_ok(const Vbx& vb).
Regards,
Sundararajan S
More information about the AGENTPP
mailing list