From 82a6c22158618bc1e7738bf08bf1b305179935dc Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Mon, 28 Nov 2011 15:29:51 +0200 Subject: [PATCH] Ommit "too big" error --- src/snmptable.cpp | 6 +++++- src/switch.cpp | 14 +++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/snmptable.cpp b/src/snmptable.cpp index 5937270..e729b05 100644 --- a/src/snmptable.cpp +++ b/src/snmptable.cpp @@ -11,7 +11,11 @@ SNMPTable::SNMPTable(Snmp & snmp, Vb vb(oid); Pdu pdu(&vb, 1); while (true) { - if (int c = snmp.get_next(pdu, target) != SNMP_CLASS_SUCCESS) { + int c = snmp.get_next(pdu, target); + for (size_t i = 0; i < 3 && c != SNMP_CLASS_SUCCESS; ++i) { + c = snmp.get_next(pdu, target); + } + if (c != SNMP_CLASS_SUCCESS) { logger << "SNMPTable::SNMPTable() - failed to invoke Snmp::get_next (oid: '" << oid.get_printable() << "'). Error message: '" << Snmp::error_msg(c) << "'" << std::endl; return; } diff --git a/src/switch.cpp b/src/switch.cpp index 01024a1..f189ba6 100644 --- a/src/switch.cpp +++ b/src/switch.cpp @@ -221,8 +221,10 @@ bool Switch::dropACLsByTable(const CTarget & target, unsigned profileId, const S pdu += vb; } if (int c = _snmp.set(pdu, target) != SNMP_CLASS_SUCCESS) { - logger << "Switch::dropACLsByTable() - failed to invoke Snmp::set for the switch '" << _ip << "'. Error message: '" << Snmp::error_msg(c) << "'" << std::endl; - return false; + if (c != SNMP_ERROR_TOO_BIG) { + logger << "Switch::dropACLsByTable() - failed to invoke Snmp::set for the switch '" << _ip << "'. Error message: '" << Snmp::error_msg(c) << "'" << std::endl; + return false; + } } } return true; @@ -236,9 +238,11 @@ bool Switch::createACLs(const CTarget & target) Pdu pdu; it->appendPdu(pdu); if (int c = _snmp.set(pdu, target) != SNMP_CLASS_SUCCESS) { - logger << "Switch::createACLs() - failed to invoke Snmp::set for the switch '" << _ip << "'. Error message: '" << Snmp::error_msg(c) << "'. Error occured at creation of " << (pos + 1) << " from " << _acls.size() << " ACL's" << std::endl; - logger << "Switch::createACLs() - ACL dump: " << *it << std::endl; - return false; + if (c != SNMP_ERROR_TOO_BIG) { + logger << "Switch::createACLs() - failed to invoke Snmp::set for the switch '" << _ip << "'. Error message: '" << Snmp::error_msg(c) << "'. Error occured at creation of " << (pos + 1) << " from " << _acls.size() << " ACL's" << std::endl; + logger << "Switch::createACLs() - ACL dump: " << *it << std::endl; + return false; + } } _aclsCreated = true; ++pos; -- 2.43.2