]> git.stg.codes - ssmd.git/blobdiff - src/switch.cpp
Paranoid Pdu clearing
[ssmd.git] / src / switch.cpp
index db8a1be6227dae9953e680bc2771f944610fc5b6..1fb0d66457bc2b3f84f9e977fb7dcaadfb77b3ce 100644 (file)
@@ -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;
@@ -231,14 +233,20 @@ bool Switch::dropACLsByTable(const CTarget & target, unsigned profileId, const S
 bool Switch::createACLs(const CTarget & target)
 {
     std::vector<ACL>::const_iterator it;
+    size_t pos = 0;
     for (it = _acls.begin(); it != _acls.end(); ++it) {
         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) << "'" << 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;
+            }
         }
+        pdu.clear();
         _aclsCreated = true;
+        ++pos;
     }
     return true;
 }