]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: add handler for pw install errors
authorMark Stapp <mjs@voltanet.io>
Mon, 10 Dec 2018 21:44:14 +0000 (16:44 -0500)
committerMark Stapp <mjs@voltanet.io>
Fri, 25 Jan 2019 15:45:57 +0000 (10:45 -0500)
Add handler for async error results from the dataplane for
pseudowire installation attempts.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
zebra/zebra_dplane.c
zebra/zebra_rib.c

index 47ee67d46cca5ba715a3fdfda43316a6e955a5bc..afaa4e85ebf8fdfbbb6395ec9edf2000d8ba9bb4 100644 (file)
@@ -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;
index 0dc8a05e9c6d66742b9eeb34d4fde4769ef5b633..31bd84d791d67e8e0daa810ca46adaf94759f526 100644 (file)
@@ -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);