Skip to content

Commit

Permalink
Merge pull request polycube-network#351 from pinoOgni/pgn/router-bug-fix
Browse files Browse the repository at this point in the history
Solved router bug reported in issue polycube-network#349
  • Loading branch information
frisso committed Oct 27, 2020
2 parents d2f64b6 + 6500631 commit 680d771
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/services/pcn-router/src/Ports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,16 +255,20 @@ void Ports::addSecondaryip(const std::string &ip, const PortsSecondaryipJsonObje
/*
* First create the port in the control plane
*/
logger()->info(
"Adding secondary address [port: {0} - ip: {1}]", getName(), ip);
if (!this->getIp().empty()) {
logger()->info(
"Adding secondary address [port: {0} - ip: {1}]", getName(), ip);

auto ret = secondary_ips_.emplace(PortsSecondaryip(*this, conf));
auto ret = secondary_ips_.emplace(PortsSecondaryip(*this, conf));

/*
* Then update the port in the data path (this also adds the proper routes in
* the routing table)
*/
updatePortInDataPath();
/*
* Then update the port in the data path (this also adds the proper routes in
* the routing table)
*/
updatePortInDataPath();
} else
throw std::runtime_error(
"You can not add a secondary ip address to a port with no ip address");
}

// Basic default implementation, place your extension here (if needed)
Expand Down

0 comments on commit 680d771

Please sign in to comment.