Commit da50f2a3 authored by Christof Schulze's avatar Christof Schulze Committed by Juliusz Chroboczek

FIX: NO SUCH DEVICE when adding routes

When adding unreachable routes and setting the RTNH_F_ONLINK flag, a
device is required to be specified. In Linux kernel 4.16 support for
this flag was added. Until now it was ignored.
If RTNH_F_ONLINK is specified while the device is missing, newer kernels
will respond with No such device.
The result is:
* spam in the log file
* missing routes for both ipv4 and ipv6
parent 8cbc75db
...@@ -1025,12 +1025,13 @@ kernel_route(int operation, int table, ...@@ -1025,12 +1025,13 @@ kernel_route(int operation, int table,
rtm->rtm_src_len = src_plen; rtm->rtm_src_len = src_plen;
rtm->rtm_table = table; rtm->rtm_table = table;
rtm->rtm_scope = RT_SCOPE_UNIVERSE; rtm->rtm_scope = RT_SCOPE_UNIVERSE;
if(metric < KERNEL_INFINITY) if(metric < KERNEL_INFINITY) {
rtm->rtm_type = RTN_UNICAST; rtm->rtm_type = RTN_UNICAST;
else rtm->rtm_flags |= RTNH_F_ONLINK;
} else
rtm->rtm_type = RTN_UNREACHABLE; rtm->rtm_type = RTN_UNREACHABLE;
rtm->rtm_protocol = RTPROT_BABEL; rtm->rtm_protocol = RTPROT_BABEL;
rtm->rtm_flags |= RTNH_F_ONLINK;
rta = RTM_RTA(rtm); rta = RTM_RTA(rtm);
......
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