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

fix warning and crash #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions src/iface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ void iface::handle_reverse_advert(const address& saddr, const std::string& ifnam
for (std::list<ptr<rule> >::iterator it = parent->rules_begin(); it != parent->rules_end(); it++) {
ptr<rule> ru = *it;

if (ru->addr() == saddr &&
if (ru->addr() == saddr && ru->daughter() &&
ru->daughter()->name() == ifname)
{
logger::debug() << " - generating artifical advertisement: " << ifname;
Expand Down Expand Up @@ -664,7 +664,7 @@ int iface::poll_all()
if (is_pfd) {
size = ifa->read_solicit(saddr, daddr, taddr);
if (size < 0) {
logger::error() << "Failed to read from interface '%s'", ifa->_name.c_str();
logger::error() << "Failed to read from interface '" << ifa->_name.c_str() << "'";
continue;
}
if (size == 0) {
Expand Down Expand Up @@ -703,7 +703,7 @@ int iface::poll_all()
} else {
size = ifa->read_advert(saddr, taddr);
if (size < 0) {
logger::error() << "Failed to read from interface '%s'", ifa->_name.c_str();
logger::error() << "Failed to read from interface '" << ifa->_name.c_str() << "'";
continue;
}
if (size == 0) {
Expand Down
24 changes: 20 additions & 4 deletions src/session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,11 @@ void session::handle_auto_wire(const address& saddr, const std::string& ifname,
logger::debug()
<< "session::system(" << route_cmd.str() << ")";

system(route_cmd.str().c_str());
int ret = system(route_cmd.str().c_str());
if (ret != 0) {
logger::error()
<< "system(" << route_cmd.str().c_str() << ") failed, return " << ret;
}

_wired_via = saddr;
}
Expand All @@ -233,7 +237,11 @@ void session::handle_auto_wire(const address& saddr, const std::string& ifname,
logger::debug()
<< "session::system(" << route_cmd.str() << ")";

system(route_cmd.str().c_str());
int ret = system(route_cmd.str().c_str());
if (ret != 0) {
logger::error()
<< "system(" << route_cmd.str().c_str() << ") failed, return " << ret;
}
}

_wired = true;
Expand Down Expand Up @@ -261,7 +269,11 @@ void session::handle_auto_unwire(const std::string& ifname)
logger::debug()
<< "session::system(" << route_cmd.str() << ")";

system(route_cmd.str().c_str());
int ret = system(route_cmd.str().c_str());
if (ret != 0) {
logger::error()
<< "system(" << route_cmd.str().c_str() << ") failed, return " << ret;
}
}

if (_wired_via.is_empty() == false) {
Expand All @@ -277,7 +289,11 @@ void session::handle_auto_unwire(const std::string& ifname)
logger::debug()
<< "session::system(" << route_cmd.str() << ")";

system(route_cmd.str().c_str());
int ret = system(route_cmd.str().c_str());
if (ret != 0) {
logger::error()
<< "system(" << route_cmd.str().c_str() << ") failed, return " << ret;
}
}

_wired = false;
Expand Down