Skip to content

Commit d0123a9

Browse files
committed
zebra: Static routes async notification do not need this test
When using asic_offload with an asynchronous notification the rib_route_match_ctx function is testing for distance and tag being correct against the re. Normal route notification for static routes is this(well really all routes): a) zebra dplane generates a ctx to send to the dplane for route install b) dplane installs it in the kernel c) if the dplane_fpm_nl.c module is being used it installs it. d) The context's success code is set to it worked and passes the context back up to zebra for processing. e) Zebra master receives this and checks the distance and tag are correct for static routes and accepts the route and marks it installed. If the operator is using a wait for install mechansim where the dplane is asynchronously sending the result back up at a future time *and* it is using the dplane_fpm_nl.c code where it uses the rt_netlink.c route parsing code, then there is no way to set distance as that we do not pass distance to the kernel. As such static routes were never being properly handled since the re and context would not match and the route would still be marked as queued. Modify the code such that the asynchronous path notification for static routes ignores the distance and tag's as that there is no way to test for this data from that path at this point in time. Signed-off-by: Donald Sharp <[email protected]>
1 parent 1ce1c53 commit d0123a9

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

zebra/zebra_rib.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,7 @@ static void zebra_rib_evaluate_mpls(struct route_node *rn)
14381438
*/
14391439
static bool rib_route_match_ctx(const struct route_entry *re,
14401440
const struct zebra_dplane_ctx *ctx,
1441-
bool is_update)
1441+
bool is_update, bool async)
14421442
{
14431443
bool result = false;
14441444

@@ -1454,13 +1454,12 @@ static bool rib_route_match_ctx(const struct route_entry *re,
14541454
/* We use an extra test for statics, and another for
14551455
* kernel routes.
14561456
*/
1457-
if (re->type == ZEBRA_ROUTE_STATIC &&
1457+
if (re->type == ZEBRA_ROUTE_STATIC && !async &&
14581458
(re->distance != dplane_ctx_get_old_distance(ctx) ||
14591459
re->tag != dplane_ctx_get_old_tag(ctx))) {
14601460
result = false;
14611461
} else if (re->type == ZEBRA_ROUTE_KERNEL &&
1462-
re->metric !=
1463-
dplane_ctx_get_old_metric(ctx)) {
1462+
re->metric != dplane_ctx_get_old_metric(ctx)) {
14641463
result = false;
14651464
}
14661465
}
@@ -1482,7 +1481,7 @@ static bool rib_route_match_ctx(const struct route_entry *re,
14821481
/* We use an extra test for statics, and another for
14831482
* kernel routes.
14841483
*/
1485-
if (re->type == ZEBRA_ROUTE_STATIC &&
1484+
if (re->type == ZEBRA_ROUTE_STATIC && !async &&
14861485
(re->distance != dplane_ctx_get_distance(ctx) ||
14871486
re->tag != dplane_ctx_get_tag(ctx))) {
14881487
result = false;
@@ -1946,13 +1945,13 @@ static void rib_process_result(struct zebra_dplane_ctx *ctx)
19461945
RNODE_FOREACH_RE(rn, rib) {
19471946

19481947
if (re == NULL) {
1949-
if (rib_route_match_ctx(rib, ctx, false))
1948+
if (rib_route_match_ctx(rib, ctx, false, false))
19501949
re = rib;
19511950
}
19521951

19531952
/* Check for old route match */
19541953
if (is_update && (old_re == NULL)) {
1955-
if (rib_route_match_ctx(rib, ctx, true /*is_update*/))
1954+
if (rib_route_match_ctx(rib, ctx, true, false))
19561955
old_re = rib;
19571956
}
19581957

@@ -2271,7 +2270,7 @@ static void rib_process_dplane_notify(struct zebra_dplane_ctx *ctx)
22712270
* info.
22722271
*/
22732272
RNODE_FOREACH_RE(rn, re) {
2274-
if (rib_route_match_ctx(re, ctx, false /*!update*/))
2273+
if (rib_route_match_ctx(re, ctx, false, true))
22752274
break;
22762275
}
22772276

0 commit comments

Comments
 (0)