diff options
Diffstat (limited to 'zebra/zebra_dplane.c')
| -rw-r--r-- | zebra/zebra_dplane.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index 6e8d35aa77..abd0adb64e 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -210,6 +210,7 @@ struct dplane_ctx_rule { uint8_t dsfield; struct prefix src_ip; struct prefix dst_ip; + char ifname[INTERFACE_NAMSIZ + 1]; }; struct dplane_rule_info { @@ -1632,6 +1633,13 @@ int dplane_ctx_rule_get_sock(const struct zebra_dplane_ctx *ctx) return ctx->u.rule.sock; } +const char *dplane_ctx_rule_get_ifname(const struct zebra_dplane_ctx *ctx) +{ + DPLANE_CTX_VALID(ctx); + + return ctx->u.rule.new.ifname; +} + int dplane_ctx_rule_get_unique(const struct zebra_dplane_ctx *ctx) { DPLANE_CTX_VALID(ctx); @@ -1911,10 +1919,11 @@ int dplane_ctx_route_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op, * If its a delete we only use the prefix anyway, so this only * matters for INSTALL/UPDATE. */ - if (((op == DPLANE_OP_ROUTE_INSTALL) - || (op == DPLANE_OP_ROUTE_UPDATE)) - && !CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED) - && !CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_QUEUED)) { + if (zebra_nhg_kernel_nexthops_enabled() + && (((op == DPLANE_OP_ROUTE_INSTALL) + || (op == DPLANE_OP_ROUTE_UPDATE)) + && !CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED) + && !CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_QUEUED))) { ret = ENOENT; goto done; } @@ -2190,6 +2199,7 @@ static void dplane_ctx_rule_init_single(struct dplane_ctx_rule *dplane_rule, dplane_rule->dsfield = rule->rule.filter.dsfield; prefix_copy(&(dplane_rule->dst_ip), &rule->rule.filter.dst_ip); prefix_copy(&(dplane_rule->src_ip), &rule->rule.filter.src_ip); + strlcpy(dplane_rule->ifname, rule->ifname, INTERFACE_NAMSIZ); } /** @@ -2211,10 +2221,9 @@ static int dplane_ctx_rule_init(struct zebra_dplane_ctx *ctx, char buf2[PREFIX_STRLEN]; zlog_debug( - "init dplane ctx %s: IF %s(%u) Prio %u Fwmark %u Src %s Dst %s Table %u", + "init dplane ctx %s: IF %s Prio %u Fwmark %u Src %s Dst %s Table %u", dplane_op2str(op), new_rule->ifname, - new_rule->rule.ifindex, new_rule->rule.priority, - new_rule->rule.filter.fwmark, + new_rule->rule.priority, new_rule->rule.filter.fwmark, prefix2str(&new_rule->rule.filter.src_ip, buf1, sizeof(buf1)), prefix2str(&new_rule->rule.filter.dst_ip, buf2, @@ -2231,7 +2240,6 @@ static int dplane_ctx_rule_init(struct zebra_dplane_ctx *ctx, ctx->zd_vrf_id = new_rule->vrf_id; memcpy(ctx->zd_ifname, new_rule->ifname, sizeof(new_rule->ifname)); - ctx->zd_ifindex = new_rule->rule.ifindex; ctx->u.rule.sock = new_rule->sock; ctx->u.rule.unique = new_rule->rule.unique; @@ -2352,11 +2360,8 @@ dplane_route_update_internal(struct route_node *rn, if (ret == AOK) result = ZEBRA_DPLANE_REQUEST_QUEUED; else { - if (ret == ENOENT) - result = ZEBRA_DPLANE_REQUEST_SUCCESS; - else - atomic_fetch_add_explicit(&zdplane_info.dg_route_errors, - 1, memory_order_relaxed); + atomic_fetch_add_explicit(&zdplane_info.dg_route_errors, 1, + memory_order_relaxed); if (ctx) dplane_ctx_free(&ctx); } |
