Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup some more coverity complaints #557

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agent-ovs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ if RENDERER_OVS
ovs/OvsdbMessage.cpp \
ovs/OvsdbMonitorMessage.cpp \
ovs/CtZoneManager.cpp \
ovs/DnsManager.cpp \
ovs/DnsManager.cpp \
ovs/NatStatsManager.cpp \
ovs/EndpointTenantMapper.cpp

Expand Down
1 change: 0 additions & 1 deletion agent-ovs/cmd/mcast_daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <unordered_map>
#include <memory>
#include <thread>
#include <functional>

#include <csignal>
#include <cstring>
Expand Down
2 changes: 1 addition & 1 deletion agent-ovs/lib/PolicyManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2022,7 +2022,7 @@ void PolicyManager::updateL3Nets(const opflex::modb::URI& rdURI,
net, contractsToNotify);
}
}
rds.extNets = newNets;
rds.extNets = std::move(newNets);
} else {
for (const URI& net : rds.extNets) {
l3n_map.erase(net);
Expand Down
6 changes: 3 additions & 3 deletions agent-ovs/lib/include/opflexagent/PolicyManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,13 @@ class PolicyRoute {
*/
PolicyRoute(std::shared_ptr<modelgbp::gbp::RoutingDomain>& rd_,
std::shared_ptr<modelgbp::gbpe::InstContext>& rdInst_,
const boost::asio::ip::address& addr_, uint8_t pfx_len_,
boost::asio::ip::address addr_, uint8_t pfx_len_,
std::list<boost::asio::ip::address> &nh_,
std::shared_ptr<modelgbp::gbp::ExternalNode> nd_=
std::shared_ptr<modelgbp::gbp::ExternalNode>()):
rd(rd_), rdInst(rdInst_), address(addr_),
rd(rd_), rdInst(rdInst_), address(std::move(addr_)),
prefix_len(pfx_len_), nextHops(nh_), present(false),
nd(nd_) {};
nd(std::move(nd_)) {};

/**
* Copy constructor.
Expand Down
2 changes: 1 addition & 1 deletion agent-ovs/ovs/AccessFlowManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ void AccessFlowManager::setDropLog(const string& dropLogPort, const string& drop
} else if (tunDst.is_v6()) {
LOG(ERROR) << "IPv6 drop-log tunnel destinations are not supported";
} else {
dropLogDst = tunDst;
dropLogDst = std::move(tunDst);
LOG(INFO) << "DropLog port set to " << dropLogPort
<< " tunnel destination: " << dropLogRemoteIp
<< ":" <<_dropLogRemotePort;
Expand Down
4 changes: 2 additions & 2 deletions agent-ovs/ovs/IntFlowManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ static void flowsEndpointDHCPSource(IntFlowManager& flowMgr,
LOG(WARNING) << "Invalid DHCP server IP: "
<< v4c.get().getServerIp().get();
} else {
serverIp = sip;
serverIp = std::move(sip);
}
}

Expand Down Expand Up @@ -6827,7 +6827,7 @@ IntFlowManager::reconcileFlows(vector<TableState> flowTables,
}
}

return SwitchStateHandler::reconcileFlows(flowTables, recvFlows);
return SwitchStateHandler::reconcileFlows(std::move(flowTables), recvFlows);
}

GroupEdit IntFlowManager::reconcileGroups(GroupMap& recvGroups) {
Expand Down
2 changes: 1 addition & 1 deletion agent-ovs/ovs/OVSRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ void OVSRenderer::onCleanupTimer(const boost::system::error_code& ec) {
bind(connTrackIdGarbageCb,
std::ref(getEndpointManager()),
std::ref(getFramework()), _1, _2);
idGen.collectGarbage(ID_NMSPC_CONNTRACK, gcb);
idGen.collectGarbage(ID_NMSPC_CONNTRACK, std::move(gcb));

if (started) {
const std::lock_guard<std::mutex> guard(timer_mutex);
Expand Down
6 changes: 3 additions & 3 deletions agent-ovs/ovs/PacketInHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ static void send_packet_out(Agent& agent,
LOG(WARNING) << "Port " << out_port << " not found in int bridge";
}

send_packet_out(conn, b, proto, in_port, out_port, outActions);
send_packet_out(conn, b, proto, in_port, out_port, std::move(outActions));
/*
* Openshift bootstrap does not support vlans, so make a copy
*/
Expand Down Expand Up @@ -700,7 +700,7 @@ static void handleVIPPktIn(bool v4,
}

unordered_set<ep_ptr> eps =
findEpsForIface(epMgr, iface,
findEpsForIface(epMgr, std::move(iface),
[&srcMac, &srcIp](const Endpoint& ep) {
for (const Endpoint::virt_ip_t& vip :
ep.getVirtualIPs()) {
Expand Down Expand Up @@ -773,7 +773,7 @@ static void handleICMPErrPktIn(bool v4,
<< " on " << pi.flow_metadata.flow.regs[7];

send_packet_out(agent, intConn, accConn, intFlowManager,
intPortMapper, accPortMapper, egUri,
intPortMapper, accPortMapper, std::move(egUri),
b, proto, pi.flow_metadata.flow.regs[7],
OFPP_IN_PORT);
}
Expand Down
2 changes: 1 addition & 1 deletion agent-ovs/ovs/Packets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ static const size_t MAX_ROUTE = 16;
class Routev4 {
public:
Routev4(address_v4 dest_, uint8_t prefixLen_, address_v4 nextHop_)
: dest(dest_), prefixLen(prefixLen_), nextHop(nextHop_) {}
: dest(std::move(dest_)), prefixLen(prefixLen_), nextHop(std::move(nextHop_)) {}
address_v4 dest;
uint8_t prefixLen;
address_v4 nextHop;
Expand Down
4 changes: 2 additions & 2 deletions agent-ovs/ovs/QosRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ namespace opflexagent {
OvsdbTransactMessage msg1(OvsdbOperation::UPDATE, OvsdbTable::INTERFACE);
set<tuple<string, OvsdbFunction, string>> conditionSet;
conditionSet.emplace("name", OvsdbFunction::EQ, interface);
msg1.conditions = conditionSet;
msg1.conditions = std::move(conditionSet);

vector<OvsdbValue> values;
values.emplace_back(rate);
Expand Down Expand Up @@ -249,7 +249,7 @@ namespace opflexagent {

OvsdbTransactMessage msg1(OvsdbOperation::UPDATE, OvsdbTable::PORT);
vector<OvsdbValue> values;
OvsdbValues emptySet("set", values);
OvsdbValues emptySet("set", std::move(values));
msg1.rowData.emplace("qos", emptySet);

set<tuple<string, OvsdbFunction, string>> conditionSet;
Expand Down
4 changes: 2 additions & 2 deletions agent-ovs/ovs/SpanRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ namespace opflexagent {
vec.emplace_back("erspan_hwid", erspanHwId);
vec.emplace_back("remote_ip", session->getDestination().to_string());
vec.emplace_back("key", std::to_string(session->getSessionId()));
OvsdbValues values3("map", vec);
OvsdbValues values3("map", std::move(vec));
msg.rowData.emplace("options", values3);

set<tuple<string, OvsdbFunction, string>> condSet;
Expand Down Expand Up @@ -314,7 +314,7 @@ namespace opflexagent {
values.emplace_back("erspan_hwid", erspanHwId);
values.emplace_back("remote_ip", sess->getDestination().to_string());
values.emplace_back("key", std::to_string(sess->getSessionId()));
OvsdbValues tdSet5("map", values);
OvsdbValues tdSet5("map", std::move(values));
msg2.rowData.emplace("options", tdSet5);

requests.push_back(msg);
Expand Down
2 changes: 1 addition & 1 deletion agent-ovs/ovs/include/IntFlowManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ class IntFlowManager : public SwitchStateHandler,
};
struct FlowKey {
FlowKey(std::string k1, uint32_t k2, uint32_t k3) {
ip=k1;
ip=std::move(k1);
reg=k2;
rd = k3;
}
Expand Down
2 changes: 1 addition & 1 deletion agent-ovs/ovs/include/NatStatsManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class NatStatsManager :public PolicyStatsManager {
NatTrafficFlowMatchKey_t(uint32_t k1, uint32_t k2, string k3) {
vnid = k1;
rd = k2;
ip = k3;
ip = std::move(k3);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions agent-ovs/ovs/test/NetFlowRenderer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ class NetFlowRendererFixture : public BaseFixture {
// simulate results of monitor
OvsdbRowDetails rowDetails;
std::string uuid = " 9b7295f4-07a8-41ac-a681-e0ee82560262";
rowDetails["uuid"] = OvsdbValue(uuid);
rowDetails["uuid"] = OvsdbValue(std::move(uuid));
OvsdbTableDetails tableDetails;
tableDetails["br-int"] = rowDetails;
conn->getOvsdbState().fullUpdate(OvsdbTable::BRIDGE, tableDetails);
tableDetails["br-int"] = std::move(rowDetails);
conn->getOvsdbState().fullUpdate(OvsdbTable::BRIDGE, std::move(tableDetails));
}

virtual ~NetFlowRendererFixture() {
Expand Down
2 changes: 1 addition & 1 deletion agent-ovs/server/opflex_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ int main(int argc, char** argv) {
Mutator mutator(framework, "init");
std::shared_ptr<modelgbp::dmtree::Root> root =
modelgbp::dmtree::Root::createRootElement(framework);
Agent::createUniverse(root);
Agent::createUniverse(std::move(root));
mutator.commit();

GbpOpflexServer server(server_port, SERVER_ROLES, peer_vec,
Expand Down