Allows importing 'onlink' routes.
This commit is contained in:
parent
4cdd078453
commit
bff74c7aa3
1 changed files with 21 additions and 5 deletions
|
@ -682,6 +682,21 @@ nl_parse_route(struct nlmsghdr *h, int scan)
|
||||||
ra.dest = RTD_ROUTER;
|
ra.dest = RTD_ROUTER;
|
||||||
memcpy(&ra.gw, RTA_DATA(a[RTA_GATEWAY]), sizeof(ra.gw));
|
memcpy(&ra.gw, RTA_DATA(a[RTA_GATEWAY]), sizeof(ra.gw));
|
||||||
ipa_ntoh(ra.gw);
|
ipa_ntoh(ra.gw);
|
||||||
|
|
||||||
|
if (i->rtm_flags & RTNH_F_ONLINK)
|
||||||
|
{
|
||||||
|
/* route with 'onlink' attribute */
|
||||||
|
ra.iface = if_find_by_index(oif);
|
||||||
|
if (ra.iface == NULL)
|
||||||
|
{
|
||||||
|
log(L_WARN "Kernel told us to use unknown interface %u for %I/%d",
|
||||||
|
oif, net->n.prefix, net->n.pxlen);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* standard route */
|
||||||
ng = neigh_find(&p->p, &ra.gw, 0);
|
ng = neigh_find(&p->p, &ra.gw, 0);
|
||||||
if (ng && ng->scope)
|
if (ng && ng->scope)
|
||||||
ra.iface = ng->iface;
|
ra.iface = ng->iface;
|
||||||
|
@ -691,6 +706,7 @@ nl_parse_route(struct nlmsghdr *h, int scan)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ra.dest = RTD_DEVICE;
|
ra.dest = RTD_DEVICE;
|
||||||
|
|
Loading…
Reference in a new issue