*/
static pthread_mutex_t dplane_mutex;
static struct thread *t_dplane;
-static struct dplane_ctx_q rib_dplane_q;
+static struct dplane_ctx_list_head rib_dplane_q;
DEFINE_HOOK(rib_update, (struct route_node * rn, const char *reason),
(rn, reason));
vrf),
vrf_id, rn);
rib_unlink(rn, re);
+ continue;
} else
SET_FLAG(re->status,
ROUTE_ENTRY_REMOVED);
ctxnhg->nexthop != NULL ? "" : " (empty)");
/* Set the flag about the dedicated fib list */
- SET_FLAG(re->status, ROUTE_ENTRY_USE_FIB_NHG);
- if (ctxnhg->nexthop)
- copy_nexthops(&(re->fib_ng.nexthop), ctxnhg->nexthop, NULL);
+ if (zrouter.asic_notification_nexthop_control) {
+ SET_FLAG(re->status, ROUTE_ENTRY_USE_FIB_NHG);
+ if (ctxnhg->nexthop)
+ copy_nexthops(&(re->fib_ng.nexthop), ctxnhg->nexthop,
+ NULL);
+ }
check_backups:
if (ere->src_p_provided)
apply_mask_ipv6(&ere->src_p);
- /* Set default distance by route type. */
- if (re->distance == 0)
- re->distance = route_distance(re->type);
-
/* Lookup route node.*/
rn = srcdest_rnode_get(table, &ere->p,
ere->src_p_provided ? &ere->src_p : NULL);
}
}
+ /* Set default distance by route type. */
+ if (re->distance == 0) {
+ if (same && !zebra_router_notify_on_ack())
+ re->distance = same->distance;
+ else
+ re->distance = route_distance(re->type);
+ }
+
+ if (re->metric == ROUTE_INSTALLATION_METRIC &&
+ CHECK_FLAG(re->flags, ZEBRA_FLAG_SELFROUTE)) {
+ if (same && !zebra_router_notify_on_ack())
+ re->metric = same->metric;
+ else
+ re->metric = 0;
+ }
+
/* If this route is kernel/connected route, notify the dataplane. */
if (RIB_SYSTEM_ROUTE(re)) {
/* Notify dataplane */
}
}
-static void rib_update_handle_vrf(vrf_id_t vrf_id, enum rib_update_event event,
- int rtype)
-{
- struct route_table *table;
-
- if (IS_ZEBRA_DEBUG_EVENT)
- zlog_debug("%s: Handling VRF %s event %s", __func__,
- vrf_id_to_name(vrf_id), rib_update_event2str(event));
-
- /* Process routes of interested address-families. */
- table = zebra_vrf_table(AFI_IP, SAFI_UNICAST, vrf_id);
- if (table)
- rib_update_table(table, event, rtype);
-
- table = zebra_vrf_table(AFI_IP6, SAFI_UNICAST, vrf_id);
- if (table)
- rib_update_table(table, event, rtype);
-}
-
static void rib_update_handle_vrf_all(enum rib_update_event event, int rtype)
{
struct zebra_router_table *zrt;
struct rib_update_ctx {
enum rib_update_event event;
- bool vrf_all;
vrf_id_t vrf_id;
};
ctx = THREAD_ARG(thread);
- if (ctx->vrf_all)
- rib_update_handle_vrf_all(ctx->event, ZEBRA_ROUTE_ALL);
- else
- rib_update_handle_vrf(ctx->vrf_id, ctx->event, ZEBRA_ROUTE_ALL);
+ rib_update_handle_vrf_all(ctx->event, ZEBRA_ROUTE_ALL);
rib_update_ctx_fini(&ctx);
}
return;
ctx = rib_update_ctx_init(0, event);
- ctx->vrf_all = true;
thread_add_event(zrouter.master, rib_update_handler, ctx, 0,
&t_rib_update_threads[event]);
static void rib_process_dplane_results(struct thread *thread)
{
struct zebra_dplane_ctx *ctx;
- struct dplane_ctx_q ctxlist;
+ struct dplane_ctx_list_head ctxlist;
bool shut_p = false;
/* Dequeue a list of completed updates with one lock/unlock cycle */
do {
- TAILQ_INIT(&ctxlist);
+ dplane_ctx_q_init(&ctxlist);
/* Take lock controlling queue of results */
frr_with_mutex (&dplane_mutex) {
* the dataplane pthread. We enqueue the results here for processing by
* the main thread later.
*/
-static int rib_dplane_results(struct dplane_ctx_q *ctxlist)
+static int rib_dplane_results(struct dplane_ctx_list_head *ctxlist)
{
/* Take lock controlling queue of results */
frr_with_mutex (&dplane_mutex) {
/* Init dataplane, and register for results */
pthread_mutex_init(&dplane_mutex, NULL);
- TAILQ_INIT(&rib_dplane_q);
+ dplane_ctx_q_init(&rib_dplane_q);
zebra_dplane_init(rib_dplane_results);
}