summaryrefslogtreecommitdiff
path: root/zebra/zebra_rib.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_rib.c')
-rw-r--r--zebra/zebra_rib.c81
1 files changed, 25 insertions, 56 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index afe59b9593..157c67fa62 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -37,6 +37,7 @@
#include "vrf.h"
#include "workqueue.h"
#include "nexthop_group_private.h"
+#include "frr_pthread.h"
#include "zebra/zebra_router.h"
#include "zebra/connected.h"
@@ -1128,8 +1129,6 @@ static void rib_process(struct route_node *rn)
re->status, re->flags, re->distance,
re->metric);
- UNSET_FLAG(re->status, ROUTE_ENTRY_NEXTHOPS_CHANGED);
-
/* Currently selected re. */
if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED)) {
assert(old_selected == NULL);
@@ -1364,6 +1363,7 @@ static void zebra_rib_fixup_system(struct route_node *rn)
continue;
SET_FLAG(re->status, ROUTE_ENTRY_INSTALLED);
+ UNSET_FLAG(re->status, ROUTE_ENTRY_QUEUED);
for (ALL_NEXTHOPS(re->ng, nhop)) {
if (CHECK_FLAG(nhop->flags, NEXTHOP_FLAG_RECURSIVE))
@@ -1775,7 +1775,7 @@ static void rib_process_result(struct zebra_dplane_ctx *ctx)
/* Redistribute */
redistribute_update(dest_pfx, src_pfx,
- re, NULL);
+ re, old_re);
}
/*
@@ -1927,6 +1927,9 @@ static void rib_process_dplane_notify(struct zebra_dplane_ctx *ctx)
goto done;
}
+ /* Ensure we clear the QUEUED flag */
+ UNSET_FLAG(re->status, ROUTE_ENTRY_QUEUED);
+
/* Is this a notification that ... matters? We only really care about
* the route that is currently selected for installation.
*/
@@ -1991,7 +1994,7 @@ static void rib_process_dplane_notify(struct zebra_dplane_ctx *ctx)
dplane_ctx_get_vrf(ctx), dest_str);
/* We expect this to be the selected route, so we want
- * to tell others about this transistion.
+ * to tell others about this transition.
*/
SET_FLAG(re->status, ROUTE_ENTRY_INSTALLED);
@@ -2967,50 +2970,6 @@ void rib_update_table(struct route_table *table, rib_update_event_t event)
RIB_ROUTE_ANY_QUEUED))
continue;
switch (event) {
- case RIB_UPDATE_IF_CHANGE:
- /* Examine all routes that won't get processed by the
- * protocol or
- * triggered by nexthop evaluation (NHT). This would be
- * system,
- * kernel and certain static routes. Note that NHT will
- * get
- * triggered upon an interface event as connected routes
- * always
- * get queued for processing.
- */
- RNODE_FOREACH_RE_SAFE (rn, re, next) {
- struct nexthop *nh;
-
- if (re->type != ZEBRA_ROUTE_SYSTEM
- && re->type != ZEBRA_ROUTE_KERNEL
- && re->type != ZEBRA_ROUTE_CONNECT
- && re->type != ZEBRA_ROUTE_STATIC)
- continue;
-
- if (re->type != ZEBRA_ROUTE_STATIC) {
- SET_FLAG(re->status,
- ROUTE_ENTRY_CHANGED);
- rib_queue_add(rn);
- continue;
- }
-
- for (nh = re->ng.nexthop; nh; nh = nh->next)
- if (!(nh->type == NEXTHOP_TYPE_IPV4
- || nh->type == NEXTHOP_TYPE_IPV6))
- break;
-
- /* If we only have nexthops to a
- * gateway, NHT will
- * take care.
- */
- if (nh) {
- SET_FLAG(re->status,
- ROUTE_ENTRY_CHANGED);
- rib_queue_add(rn);
- }
- }
- break;
-
case RIB_UPDATE_RMAP_CHANGE:
case RIB_UPDATE_OTHER:
/* Right now, examine all routes. Can restrict to a
@@ -3220,7 +3179,7 @@ static int handle_pw_result(struct zebra_dplane_ctx *ctx)
if (dplane_ctx_get_status(ctx) != ZEBRA_DPLANE_REQUEST_SUCCESS) {
vrf = zebra_vrf_lookup_by_id(dplane_ctx_get_vrf(ctx));
- pw = zebra_pw_find(vrf, dplane_ctx_get_pw_ifname(ctx));
+ pw = zebra_pw_find(vrf, dplane_ctx_get_ifname(ctx));
if (pw)
zebra_pw_install_failure(pw);
}
@@ -3246,12 +3205,10 @@ static int rib_process_dplane_results(struct thread *thread)
TAILQ_INIT(&ctxlist);
/* Take lock controlling queue of results */
- pthread_mutex_lock(&dplane_mutex);
- {
+ frr_with_mutex(&dplane_mutex) {
/* Dequeue list of context structs */
dplane_ctx_list_append(&ctxlist, &rib_dplane_q);
}
- pthread_mutex_unlock(&dplane_mutex);
/* Dequeue context block */
ctx = dplane_ctx_dequeue(&ctxlist);
@@ -3312,10 +3269,24 @@ static int rib_process_dplane_results(struct thread *thread)
dplane_ctx_fini(&ctx);
break;
- default:
+ case DPLANE_OP_MAC_INSTALL:
+ case DPLANE_OP_MAC_DELETE:
+ zebra_vxlan_handle_result(ctx);
+ break;
+
+ /* Some op codes not handled here */
+ case DPLANE_OP_ADDR_INSTALL:
+ case DPLANE_OP_ADDR_UNINSTALL:
+ case DPLANE_OP_NEIGH_INSTALL:
+ case DPLANE_OP_NEIGH_UPDATE:
+ case DPLANE_OP_NEIGH_DELETE:
+ case DPLANE_OP_VTEP_ADD:
+ case DPLANE_OP_VTEP_DELETE:
+ case DPLANE_OP_NONE:
/* Don't expect this: just return the struct? */
dplane_ctx_fini(&ctx);
break;
+
} /* Dispatch by op code */
ctx = dplane_ctx_dequeue(&ctxlist);
@@ -3337,12 +3308,10 @@ static int rib_process_dplane_results(struct thread *thread)
static int rib_dplane_results(struct dplane_ctx_q *ctxlist)
{
/* Take lock controlling queue of results */
- pthread_mutex_lock(&dplane_mutex);
- {
+ frr_with_mutex(&dplane_mutex) {
/* Enqueue context blocks */
dplane_ctx_list_append(&rib_dplane_q, ctxlist);
}
- pthread_mutex_unlock(&dplane_mutex);
/* Ensure event is signalled to zebra main pthread */
thread_add_event(zrouter.master, rib_process_dplane_results, NULL, 0,