]> git.puffer.fish Git - mirror/frr.git/commitdiff
*: Add code to notify on route removal status 1852/head
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 8 Mar 2018 15:25:12 +0000 (10:25 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 9 Mar 2018 00:50:06 +0000 (19:50 -0500)
If a interested party removes one of it's routes let
it know that it has happened as asked for.

Add a ZAPI_ROUTE_REMOVED to the send of the route_notify_owner
Add a ZAPI_ROUTE_REMOVE_FAIL to the send of the route_notify_owner

Add code in sharpd to notice this and to allow it to keep
track of routes removed for that invocation and give timing
results.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/zclient.h
sharpd/sharp_zebra.c
zebra/zebra_rib.c

index e0b39c88e89b9e4bd7afa0aac4f978fd6242ae13..1848440db29fe149055ad72de1ef2d2f0f126e4b 100644 (file)
@@ -346,6 +346,8 @@ enum zapi_route_notify_owner {
        ZAPI_ROUTE_FAIL_INSTALL,
        ZAPI_ROUTE_BETTER_ADMIN_WON,
        ZAPI_ROUTE_INSTALLED,
+       ZAPI_ROUTE_REMOVED,
+       ZAPI_ROUTE_REMOVE_FAIL,
 };
 
 /* Zebra MAC types */
index c1c827c3664adf2f33ecc04f31e11b5d49407743..8915397c7e7455cf01e3e248cc8d8084bea5bf8c 100644 (file)
@@ -130,6 +130,7 @@ static int interface_state_down(int command, struct zclient *zclient,
 
 extern uint32_t total_routes;
 extern uint32_t installed_routes;
+extern uint32_t removed_routes;
 
 static int route_notify_owner(int command, struct zclient *zclient,
                              zebra_size_t length, vrf_id_t vrf_id)
@@ -141,10 +142,27 @@ static int route_notify_owner(int command, struct zclient *zclient,
        if (!zapi_route_notify_decode(zclient->ibuf, &p, &table, &note))
                return -1;
 
-       installed_routes++;
-
-       if (total_routes == installed_routes)
-               zlog_debug("Installed All Items");
+       switch (note) {
+       case ZAPI_ROUTE_INSTALLED:
+               installed_routes++;
+               if (total_routes == installed_routes)
+                       zlog_debug("Installed All Items");
+               break;
+       case ZAPI_ROUTE_FAIL_INSTALL:
+               zlog_debug("Failed install of route");
+               break;
+       case ZAPI_ROUTE_BETTER_ADMIN_WON:
+               zlog_debug("Better Admin Distance won over us");
+               break;
+       case ZAPI_ROUTE_REMOVED:
+               removed_routes++;
+               if (total_routes == removed_routes)
+                       zlog_debug("Removed all Items");
+               break;
+       case ZAPI_ROUTE_REMOVE_FAIL:
+               zlog_debug("Route removal Failure");
+               break;
+       }
        return 0;
 }
 
index 8946c9c6b55b1670b8415b897a39dc6c85382c19..c5906f5829c86a5b5a617ea40dda8372a704a0ca 100644 (file)
@@ -1058,6 +1058,8 @@ void kernel_route_rib_pass_fail(struct route_node *rn, struct prefix *p,
                        dest->selected_fib = NULL;
                for (ALL_NEXTHOPS(re->nexthop, nexthop))
                        UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
+
+               zsend_route_notify_owner(re, p, ZAPI_ROUTE_REMOVED);
                break;
        case SOUTHBOUND_DELETE_FAILURE:
                /*
@@ -1067,6 +1069,8 @@ void kernel_route_rib_pass_fail(struct route_node *rn, struct prefix *p,
                dest->selected_fib = NULL;
                zlog_warn("%u:%s: Route Deletion failure", re->vrf_id,
                          prefix2str(p, buf, sizeof(buf)));
+
+               zsend_route_notify_owner(re, p, ZAPI_ROUTE_REMOVE_FAIL);
                break;
        }
 }