Commit 2ec504a4 authored by Julien Cristau's avatar Julien Cristau

Don't try to add/delete an unreachable default route

When one tries to add such a route, Linux will reply with EEXIST.
parent f12debd6
...@@ -608,6 +608,10 @@ kernel_route(int operation, const unsigned char *dest, unsigned short plen, ...@@ -608,6 +608,10 @@ 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 */
if(metric >= KERNEL_INFINITY && plen == 0)
return 0;
if(ifindex_lo < 0) { if(ifindex_lo < 0) {
ifindex_lo = if_nametoindex("lo"); ifindex_lo = if_nametoindex("lo");
if(ifindex_lo <= 0) if(ifindex_lo <= 0)
......
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