summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--zebra/zapi_msg.c3
-rw-r--r--zebra/zebra_rib.c21
2 files changed, 16 insertions, 8 deletions
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c
index b6d0948d3..951a411f2 100644
--- a/zebra/zapi_msg.c
+++ b/zebra/zapi_msg.c
@@ -1521,6 +1521,9 @@ static void zread_route_add(ZAPI_HANDLER_ARGS)
XFREE(MTYPE_RE, re);
return;
}
+ if (api_nh->onlink)
+ SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK);
+
/* MPLS labels for BGP-LU or Segment Routing */
if (CHECK_FLAG(api.message, ZAPI_MESSAGE_LABEL)
&& api_nh->type != NEXTHOP_TYPE_IFINDEX
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 0dc8a05e9..99ddd438e 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -277,8 +277,7 @@ struct nexthop *route_entry_nexthop_ipv4_ifindex_add(struct route_entry *re,
There was a crash because ifp here was coming to be NULL */
if (ifp)
if (connected_is_unnumbered(ifp)
- || CHECK_FLAG(re->flags, ZEBRA_FLAG_EVPN_ROUTE)
- || CHECK_FLAG(re->flags, ZEBRA_FLAG_ONLINK)) {
+ || CHECK_FLAG(re->flags, ZEBRA_FLAG_EVPN_ROUTE)) {
SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK);
}
@@ -315,10 +314,8 @@ struct nexthop *route_entry_nexthop_ipv6_ifindex_add(struct route_entry *re,
nexthop->type = NEXTHOP_TYPE_IPV6_IFINDEX;
nexthop->gate.ipv6 = *ipv6;
nexthop->ifindex = ifindex;
- if (CHECK_FLAG(re->flags, ZEBRA_FLAG_EVPN_ROUTE)
- || CHECK_FLAG(re->flags, ZEBRA_FLAG_ONLINK)) {
+ if (CHECK_FLAG(re->flags, ZEBRA_FLAG_EVPN_ROUTE))
SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK);
- }
route_entry_nexthop_add(re, nexthop);
@@ -457,8 +454,15 @@ static int nexthop_active(afi_t afi, struct route_entry *re,
*/
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK)) {
ifp = if_lookup_by_index(nexthop->ifindex, nexthop->vrf_id);
- if ((ifp && connected_is_unnumbered(ifp))
- || CHECK_FLAG(re->flags, ZEBRA_FLAG_ONLINK)) {
+ if (!ifp) {
+ if (IS_ZEBRA_DEBUG_RIB_DETAILED)
+ zlog_debug(
+ "\t%s: Onlink and interface: %u[%u] does not exist",
+ __PRETTY_FUNCTION__, nexthop->ifindex,
+ nexthop->vrf_id);
+ return 0;
+ }
+ if (connected_is_unnumbered(ifp)) {
if (if_is_operative(ifp))
return 1;
else {
@@ -468,7 +472,8 @@ static int nexthop_active(afi_t afi, struct route_entry *re,
__PRETTY_FUNCTION__, ifp->name);
return 0;
}
- } else {
+ }
+ if (!if_is_operative(ifp)) {
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug(
"\t%s: Interface %s is not unnumbered",