Commit d2a64892 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Ignore unreachable default routes when monitoring kernel routes.

parent 2c4a59c7
...@@ -578,7 +578,8 @@ kernel_route(int operation, const unsigned char *dest, unsigned short plen, ...@@ -578,7 +578,8 @@ kernel_route(int operation, const unsigned char *dest, unsigned short plen,
format_address(dest), plen, metric, ifindex, format_address(dest), plen, metric, ifindex,
format_address(gate)); format_address(gate));
/* Linux sucks: it doesn't accept an unreachable default route */ /* Unreachable default routes cause all sort of weird interactions;
ignore them. */
if(metric >= KERNEL_INFINITY && plen == 0) if(metric >= KERNEL_INFINITY && plen == 0)
return 0; return 0;
...@@ -760,6 +761,10 @@ filter_kernel_routes(struct nlmsghdr *nh, void *data) ...@@ -760,6 +761,10 @@ filter_kernel_routes(struct nlmsghdr *nh, void *data)
(current_route->prefix[0] == 0xFF || current_route->prefix[0] == 0)) (current_route->prefix[0] == 0xFF || current_route->prefix[0] == 0))
return 0; return 0;
/* Ignore default unreachable routes; no idea where they come from. */
if(current_route->plen == 0 && current_route->metric >= KERNEL_INFINITY)
return 0;
if(debug >= 2) { if(debug >= 2) {
if(rc >= 0) { if(rc >= 0) {
print_kernel_route(nh->nlmsg_type, rtm->rtm_protocol, print_kernel_route(nh->nlmsg_type, rtm->rtm_protocol,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment