From e8d3d2991f72613edb76dea244a8c8e4684873dd Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Fri, 5 Jul 2013 15:35:39 +0000 Subject: zebra: implement NEXTHOP_FLAG_ONLINK On Linux, the kernel will only allow for a route to be installed when its gateway is directly attached according the kernel fib. There are cases when this restriction by the kernel is too strong, in those cases, we deploy the RTNH_F_ONLINK netlink flag. Signed-off-by: Christian Franke Signed-off-by: David Lamparter --- zebra/rt_netlink.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'zebra/rt_netlink.c') diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index b0ade058..7a820bfd 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -1443,8 +1443,11 @@ _netlink_route_build_singlepath( int bytelen, struct nexthop *nexthop, struct nlmsghdr *nlmsg, + struct rtmsg *rtmsg, size_t req_size) { + if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK)) + rtmsg->rtm_flags |= RTNH_F_ONLINK; if (nexthop->type == NEXTHOP_TYPE_IPV4 || nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX) { @@ -1534,6 +1537,9 @@ _netlink_route_build_multipath( rtnh->rtnh_hops = 0; rta->rta_len += rtnh->rtnh_len; + if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ONLINK)) + rtnh->rtnh_flags |= RTNH_F_ONLINK; + if (nexthop->type == NEXTHOP_TYPE_IPV4 || nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX) { @@ -1733,7 +1739,8 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib, _netlink_route_debug(cmd, p, nexthop, routedesc, family); _netlink_route_build_singlepath(routedesc, bytelen, - nexthop, &req.n, sizeof req); + nexthop, &req.n, &req.r, + sizeof req); if (cmd == RTM_NEWROUTE) SET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB); -- cgit v1.2.1