diff options
| author | Russ White <russ@riw.us> | 2020-05-18 17:23:57 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-18 17:23:57 -0400 |
| commit | 3bb8051aa22b7e325a01b8ddcdd8c48da6c4f2dd (patch) | |
| tree | 03a6236a409eaa3a65b4bb3c475fa19f653993a9 /zebra/zapi_msg.c | |
| parent | 0591d71e92e25cfaa2b557147b01e115029eb1cb (diff) | |
| parent | 12b4d77babf1cc5a67fe44fa83af28d1d9fc8a51 (diff) | |
Merge pull request #6421 from vivek-cumulus/zebra_trust_onlink
zebra: Trust onlink flag for nexthop active resolution
Diffstat (limited to 'zebra/zapi_msg.c')
| -rw-r--r-- | zebra/zapi_msg.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c index 092b5dd3c2..5db4555284 100644 --- a/zebra/zapi_msg.c +++ b/zebra/zapi_msg.c @@ -1451,10 +1451,6 @@ static struct nexthop *nexthop_from_zapi(struct route_entry *re, &api_nh->gate.ipv4, NULL, api_nh->ifindex, api_nh->vrf_id); - ifp = if_lookup_by_index(api_nh->ifindex, api_nh->vrf_id); - if (ifp && connected_is_unnumbered(ifp)) - SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK); - /* Special handling for IPv4 routes sourced from EVPN: * the nexthop and associated MAC need to be installed. */ @@ -1516,8 +1512,16 @@ static struct nexthop *nexthop_from_zapi(struct route_entry *re, goto done; } + /* Mark nexthop as onlink either if client has explicitly told us + * to or if the nexthop is on an 'unnumbered' interface. + */ if (CHECK_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_ONLINK)) SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK); + else if (api_nh->type == NEXTHOP_TYPE_IPV4_IFINDEX) { + ifp = if_lookup_by_index(api_nh->ifindex, api_nh->vrf_id); + if (ifp && connected_is_unnumbered(ifp)) + SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK); + } if (CHECK_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_WEIGHT)) nexthop->weight = api_nh->weight; |
