summaryrefslogtreecommitdiff
path: root/zebra/zebra_rnh.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_rnh.c')
-rw-r--r--zebra/zebra_rnh.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c
index b679803b06..67859fd46b 100644
--- a/zebra/zebra_rnh.c
+++ b/zebra/zebra_rnh.c
@@ -376,19 +376,28 @@ zebra_rnh_resolve_entry (vrf_id_t vrfid, int family, rnh_type_t type,
{
if (CHECK_FLAG (rib->status, RIB_ENTRY_REMOVED))
continue;
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
+ if (! CHECK_FLAG (rib->status, RIB_ENTRY_SELECTED_FIB))
+ continue;
+
+ if (CHECK_FLAG(rnh->flags, ZEBRA_NHT_CONNECTED))
{
- if (CHECK_FLAG(rnh->flags, ZEBRA_NHT_CONNECTED))
+ if (rib->type == ZEBRA_ROUTE_CONNECT)
+ break;
+ if (rib->type == ZEBRA_ROUTE_NHRP)
{
- if (rib->type == ZEBRA_ROUTE_CONNECT)
+ struct nexthop *nexthop;
+ for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
+ if (nexthop->type == NEXTHOP_TYPE_IFINDEX)
+ break;
+ if (nexthop)
break;
}
- else if ((type == RNH_IMPORT_CHECK_TYPE) &&
- (rib->type == ZEBRA_ROUTE_BGP))
- continue;
- else
- break;
}
+ else if ((type == RNH_IMPORT_CHECK_TYPE) &&
+ (rib->type == ZEBRA_ROUTE_BGP))
+ continue;
+ else
+ break;
}
}
@@ -904,6 +913,7 @@ send_client (struct rnh *rnh, struct zserv *client, rnh_type_t type, vrf_id_t vr
}
if (rib)
{
+ stream_putc (s, rib->distance);
stream_putl (s, rib->metric);
num = 0;
nump = stream_get_endp(s);
@@ -918,6 +928,7 @@ send_client (struct rnh *rnh, struct zserv *client, rnh_type_t type, vrf_id_t vr
{
case NEXTHOP_TYPE_IPV4:
stream_put_in_addr (s, &nexthop->gate.ipv4);
+ stream_putl (s, nexthop->ifindex);
break;
case NEXTHOP_TYPE_IFINDEX:
stream_putl (s, nexthop->ifindex);
@@ -926,15 +937,14 @@ send_client (struct rnh *rnh, struct zserv *client, rnh_type_t type, vrf_id_t vr
stream_put_in_addr (s, &nexthop->gate.ipv4);
stream_putl (s, nexthop->ifindex);
break;
-#ifdef HAVE_IPV6
case NEXTHOP_TYPE_IPV6:
stream_put (s, &nexthop->gate.ipv6, 16);
+ stream_putl (s, nexthop->ifindex);
break;
case NEXTHOP_TYPE_IPV6_IFINDEX:
stream_put (s, &nexthop->gate.ipv6, 16);
stream_putl (s, nexthop->ifindex);
break;
-#endif /* HAVE_IPV6 */
default:
/* do nothing */
break;
@@ -945,12 +955,13 @@ send_client (struct rnh *rnh, struct zserv *client, rnh_type_t type, vrf_id_t vr
}
else
{
- stream_putl (s, 0);
- stream_putc (s, 0);
+ stream_putc (s, 0); // distance
+ stream_putl (s, 0); // metric
+ stream_putc (s, 0); // nexthops
}
stream_putw_at (s, 0, stream_get_endp (s));
- client->nh_last_upd_time = quagga_monotime();
+ client->nh_last_upd_time = monotime(NULL);
client->last_write_cmd = cmd;
return zebra_server_send_message(client);
}