Skip to content

Commit

Permalink
fea: Handle funky input from netlink without crashing.
Browse files Browse the repository at this point in the history
We found a situation where we were evidently getting a bad
subnet prefix (181) reported by netlink API.  This was causing
an un-caught exception that crashed FEA.

I think I found the right place to catch this exception, but
now I cannot reproduce the failure.  Leaving in a bit of debug
print statements in case this crops up again.

Signed-off-by: Ben Greear <greearb@candelatech.com>
  • Loading branch information
greearb committed Jul 15, 2010
1 parent 4e5d93f commit 73486c5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
14 changes: 12 additions & 2 deletions xorp/fea/data_plane/control_socket/netlink_socket_utilities.cc
Expand Up @@ -563,8 +563,18 @@ NlmUtils::nlm_get_to_fte_cfg(const IfTree& iftree, FteX& fte,
//
// TODO: define default admin distance instead of 0xffff
//
fte = FteX(IPvXNet(dst_addr, dst_mask_len), nexthop_addr,
if_name, vif_name, route_metric, 0xffff, xorp_route);
try {
fte = FteX(IPvXNet(dst_addr, dst_mask_len), nexthop_addr,
if_name, vif_name, route_metric, 0xffff, xorp_route);
}
catch (XorpException& xe) {
err_msg += "exception in nlm_get_to_fte_cfg: ";
err_msg += xe.str();
err_msg += "\n";
XLOG_ERROR("exception in nlm_get_to_fte_cfg: %s", xe.str().c_str());
return XORP_ERROR;
}

if (is_deleted)
fte.mark_deleted();

Expand Down
8 changes: 8 additions & 0 deletions xorp/libxorp/exceptions.cc
Expand Up @@ -134,6 +134,14 @@ InvalidNetmaskLength::InvalidNetmaskLength(const char* file,
: XorpException("XorpInvalidNetmaskLength", file, line),
_netmask_length (netmask_length)
{
// There was a case where fea was crashing due to un-caught exception.
// Somehow, no useful info was being printed other than the exception
// name. So, add some logging here just in case it happens again.
// (On reboot, couldn't cause the problem to happen again, so not sure
// I actually fixed the root cause in fea yet.)
cerr << "Creating InvalidNetmaskLength exception, file: "
<< file << ":" << line << " netmask_length: " << netmask_length
<< endl;
}

const string
Expand Down

0 comments on commit 73486c5

Please sign in to comment.