forked from Mirror/frr
zebra: Add a switch statement for rib_process_after
Future commits are going to introduce more rigor in state setting in the case of received results from the data plane. So let us move the DPLANE_OP_ROUTE_DELETE state check to the same spot as the rest of the code that is handling a particular operation. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
88f7ea311d
commit
12e7fe3aa0
|
@ -1871,31 +1871,6 @@ static void rib_process_after(struct zebra_dplane_ctx *ctx)
|
||||||
dplane_ctx_get_vrf(ctx), dest_str, ctx,
|
dplane_ctx_get_vrf(ctx), dest_str, ctx,
|
||||||
dplane_op2str(op), dplane_res2str(status));
|
dplane_op2str(op), dplane_res2str(status));
|
||||||
|
|
||||||
if (op == DPLANE_OP_ROUTE_DELETE) {
|
|
||||||
/*
|
|
||||||
* In the delete case, the zebra core datastructs were
|
|
||||||
* updated (or removed) at the time the delete was issued,
|
|
||||||
* so we're just notifying the route owner.
|
|
||||||
*/
|
|
||||||
if (status == ZEBRA_DPLANE_REQUEST_SUCCESS) {
|
|
||||||
zsend_route_notify_owner_ctx(ctx, ZAPI_ROUTE_REMOVED);
|
|
||||||
|
|
||||||
if (zvrf)
|
|
||||||
zvrf->removals++;
|
|
||||||
} else {
|
|
||||||
zsend_route_notify_owner_ctx(ctx,
|
|
||||||
ZAPI_ROUTE_REMOVE_FAIL);
|
|
||||||
|
|
||||||
zlog_warn("%u:%s: Route Deletion failure",
|
|
||||||
dplane_ctx_get_vrf(ctx),
|
|
||||||
prefix2str(dest_pfx,
|
|
||||||
dest_str, sizeof(dest_str)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Nothing more to do in delete case */
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update is a bit of a special case, where we may have both old and new
|
* Update is a bit of a special case, where we may have both old and new
|
||||||
* routes to post-process.
|
* routes to post-process.
|
||||||
|
@ -1955,11 +1930,17 @@ static void rib_process_after(struct zebra_dplane_ctx *ctx)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (op) {
|
||||||
|
case DPLANE_OP_NONE:
|
||||||
|
break;
|
||||||
|
case DPLANE_OP_ROUTE_INSTALL:
|
||||||
|
case DPLANE_OP_ROUTE_UPDATE:
|
||||||
if (status == ZEBRA_DPLANE_REQUEST_SUCCESS) {
|
if (status == ZEBRA_DPLANE_REQUEST_SUCCESS) {
|
||||||
/* Update zebra nexthop FIB flag for each
|
/* Update zebra nexthop FIB flag for each
|
||||||
* nexthop that was installed.
|
* nexthop that was installed.
|
||||||
*/
|
*/
|
||||||
for (ALL_NEXTHOPS_PTR(dplane_ctx_get_ng(ctx), ctx_nexthop)) {
|
for (ALL_NEXTHOPS_PTR(dplane_ctx_get_ng(ctx),
|
||||||
|
ctx_nexthop)) {
|
||||||
|
|
||||||
for (ALL_NEXTHOPS(re->ng, nexthop)) {
|
for (ALL_NEXTHOPS(re->ng, nexthop)) {
|
||||||
if (nexthop_same(ctx_nexthop, nexthop))
|
if (nexthop_same(ctx_nexthop, nexthop))
|
||||||
|
@ -1969,14 +1950,17 @@ static void rib_process_after(struct zebra_dplane_ctx *ctx)
|
||||||
if (nexthop == NULL)
|
if (nexthop == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
|
if (CHECK_FLAG(nexthop->flags,
|
||||||
|
NEXTHOP_FLAG_RECURSIVE))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (CHECK_FLAG(ctx_nexthop->flags,
|
if (CHECK_FLAG(ctx_nexthop->flags,
|
||||||
NEXTHOP_FLAG_FIB))
|
NEXTHOP_FLAG_FIB))
|
||||||
SET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
|
SET_FLAG(nexthop->flags,
|
||||||
|
NEXTHOP_FLAG_FIB);
|
||||||
else
|
else
|
||||||
UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
|
UNSET_FLAG(nexthop->flags,
|
||||||
|
NEXTHOP_FLAG_FIB);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zvrf) {
|
if (zvrf) {
|
||||||
|
@ -1986,17 +1970,19 @@ static void rib_process_after(struct zebra_dplane_ctx *ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Redistribute */
|
/* Redistribute */
|
||||||
/* TODO -- still calling the redist api using the route_entries,
|
/*
|
||||||
* and there's a corner-case here: if there's no client
|
* TODO -- still calling the redist api using the
|
||||||
* for the 'new' route, a redist deleting the 'old' route
|
* route_entries, and there's a corner-case here:
|
||||||
* will be sent. But if the 'old' context info was stale,
|
* if there's no client for the 'new' route, a redist
|
||||||
* 'old_re' will be NULL here and that delete will not be sent.
|
* deleting the 'old' route will be sent. But if the
|
||||||
|
* 'old' context info was stale, 'old_re' will be
|
||||||
|
* NULL here and that delete will not be sent.
|
||||||
*/
|
*/
|
||||||
redistribute_update(dest_pfx, src_pfx, re, old_re);
|
redistribute_update(dest_pfx, src_pfx, re, old_re);
|
||||||
|
|
||||||
/* Notify route owner */
|
/* Notify route owner */
|
||||||
zsend_route_notify_owner(re,
|
zsend_route_notify_owner(re, dest_pfx,
|
||||||
dest_pfx, ZAPI_ROUTE_INSTALLED);
|
ZAPI_ROUTE_INSTALLED);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
zsend_route_notify_owner(re, dest_pfx,
|
zsend_route_notify_owner(re, dest_pfx,
|
||||||
|
@ -2007,7 +1993,29 @@ static void rib_process_after(struct zebra_dplane_ctx *ctx)
|
||||||
prefix2str(dest_pfx,
|
prefix2str(dest_pfx,
|
||||||
dest_str, sizeof(dest_str)));
|
dest_str, sizeof(dest_str)));
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case DPLANE_OP_ROUTE_DELETE:
|
||||||
|
/*
|
||||||
|
* In the delete case, the zebra core datastructs were
|
||||||
|
* updated (or removed) at the time the delete was issued,
|
||||||
|
* so we're just notifying the route owner.
|
||||||
|
*/
|
||||||
|
if (status == ZEBRA_DPLANE_REQUEST_SUCCESS) {
|
||||||
|
zsend_route_notify_owner_ctx(ctx, ZAPI_ROUTE_REMOVED);
|
||||||
|
|
||||||
|
if (zvrf)
|
||||||
|
zvrf->removals++;
|
||||||
|
} else {
|
||||||
|
zsend_route_notify_owner_ctx(ctx,
|
||||||
|
ZAPI_ROUTE_REMOVE_FAIL);
|
||||||
|
|
||||||
|
zlog_warn("%u:%s: Route Deletion failure",
|
||||||
|
dplane_ctx_get_vrf(ctx),
|
||||||
|
prefix2str(dest_pfx,
|
||||||
|
dest_str, sizeof(dest_str)));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
done:
|
done:
|
||||||
|
|
||||||
/* Return context to dataplane module */
|
/* Return context to dataplane module */
|
||||||
|
|
Loading…
Reference in a new issue