X-Git-Url: https://git.stg.codes/ssmd.git/blobdiff_plain/9182548d64cdfc6be9a0cb92aea810f65f29b299..2cb0fb0f4589e1a91719da49c12ccf3210dfb986:/src/switch.cpp?ds=sidebyside diff --git a/src/switch.cpp b/src/switch.cpp index b705402..bf18aa3 100644 --- a/src/switch.cpp +++ b/src/switch.cpp @@ -174,24 +174,27 @@ bool Switch::dropACLsByTable(const CTarget & target, unsigned profileId, const S dropACLOidPrefix += "."; dropACLOidPrefix += boost::lexical_cast(profileId); SNMPList aclsList(table.getList()); - Pdu pdu; - SNMPList::const_iterator it; - for (it = aclsList.begin(); it != aclsList.end(); ++it) { - int id; - if (int c = it->get_value(id) != SNMP_CLASS_SUCCESS) { - logger << "Switch::dropACLsByTable() - failed to get ACL id for the switch '" << _ip << "'. Error message: '" << Snmp::error_msg(c) << "'" << std::endl; + SNMPList::const_iterator it(aclsList.begin()); + size_t chunks = aclsList.size() / _settings.maxACLPerPDU() + 1; + for (size_t i = 0; i < chunks && it != aclsList.end(); ++i) { + Pdu pdu; + for (size_t j = 0; j < _settings.maxACLPerPDU() && it != aclsList.end(); ++j, ++it) { + int id; + if (int c = it->get_value(id) != SNMP_CLASS_SUCCESS) { + logger << "Switch::dropACLsByTable() - failed to get ACL id for the switch '" << _ip << "'. Error message: '" << Snmp::error_msg(c) << "'" << std::endl; + return false; + } + std::string dropACLOid(dropACLOidPrefix); + dropACLOid += "."; + dropACLOid += boost::lexical_cast(id); + Vb vb(Oid(dropACLOid.c_str())); + vb.set_value(int(6)); + 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; } - std::string dropACLOid(dropACLOidPrefix); - dropACLOid += "."; - dropACLOid += boost::lexical_cast(id); - Vb vb(Oid(dropACLOid.c_str())); - vb.set_value(int(6)); - 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; } return true; }