From: Mark Stapp Date: Mon, 10 Dec 2018 21:44:14 +0000 (-0500) Subject: zebra: add handler for pw install errors X-Git-Tag: 7.1_pulled~269^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=9bd9717bb28195bb2f0a874993f7bc89cbc47e1b;p=matthieu%2Ffrr.git zebra: add handler for pw install errors Add handler for async error results from the dataplane for pseudowire installation attempts. Signed-off-by: Mark Stapp --- diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index 47ee67d46c..afaa4e85eb 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -1058,6 +1058,7 @@ static int dplane_ctx_pw_init(struct zebra_dplane_ctx *ctx, /* This name appears to be c-string, so we use string copy. */ strlcpy(ctx->u.pw.ifname, pw->ifname, sizeof(ctx->u.pw.ifname)); + ctx->zd_vrf_id = pw->vrf_id; ctx->u.pw.ifindex = pw->ifindex; ctx->u.pw.type = pw->type; ctx->u.pw.af = pw->af; diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 0dc8a05e9c..31bd84d791 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -3190,6 +3190,34 @@ void rib_close_table(struct route_table *table) } } +/* + * Handler for async dataplane results after a pseudowire installation + */ +static int handle_pw_result(struct zebra_dplane_ctx *ctx) +{ + int ret = 0; + struct zebra_pw *pw; + struct zebra_vrf *vrf; + + /* The pseudowire code assumes success - we act on an error + * result for installation attempts here. + */ + if (dplane_ctx_get_op(ctx) != DPLANE_OP_PW_INSTALL) + goto done; + + 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)); + if (pw) + zebra_pw_install_failure(pw); + } + +done: + + return ret; +} + + /* * Handle results from the dataplane system. Dequeue update context * structs, dispatch to appropriate internal handlers. @@ -3201,8 +3229,6 @@ static int rib_process_dplane_results(struct thread *thread) /* Dequeue a list of completed updates with one lock/unlock cycle */ - /* TODO -- dequeue a list with one lock/unlock cycle? */ - do { TAILQ_INIT(&ctxlist); @@ -3235,6 +3261,11 @@ static int rib_process_dplane_results(struct thread *thread) zebra_mpls_lsp_dplane_result(ctx); break; + case DPLANE_OP_PW_INSTALL: + case DPLANE_OP_PW_UNINSTALL: + handle_pw_result(ctx); + break; + default: /* Don't expect this: just return the struct? */ dplane_ctx_fini(&ctx);