]> git.proxmox.com Git - mirror_frr.git/commitdiff
sharpd: Allow nhop tracking to specify connected
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 7 Feb 2019 03:03:34 +0000 (03:03 +0000)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 7 Feb 2019 14:35:49 +0000 (09:35 -0500)
Allow the sharp daemon to specify whether or not a watched
nexthop should be connected or not.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
sharpd/sharp_vty.c
sharpd/sharp_zebra.c
sharpd/sharp_zebra.h

index 86c8bfe1c2e79945398cd24f8d3631a823ec58ab..9ea9ff02d4d7daadd53aed239ac5efff398f88a6 100644 (file)
@@ -49,11 +49,12 @@ uint32_t rts;
 int32_t repeat;
 
 DEFPY(watch_nexthop_v6, watch_nexthop_v6_cmd,
-      "sharp watch nexthop X:X::X:X$nhop",
+      "sharp watch nexthop X:X::X:X$nhop [connected$connected]",
       "Sharp routing Protocol\n"
       "Watch for changes\n"
       "Watch for nexthop changes\n"
-      "The v6 nexthop to signal for watching\n")
+      "The v6 nexthop to signal for watching\n"
+      "Should the route be connected\n")
 {
        struct prefix p;
 
@@ -63,17 +64,18 @@ DEFPY(watch_nexthop_v6, watch_nexthop_v6_cmd,
        memcpy(&p.u.prefix6, &nhop, 16);
        p.family = AF_INET6;
 
-       sharp_zebra_nexthop_watch(&p, true);
+       sharp_zebra_nexthop_watch(&p, true, !!connected);
 
        return CMD_SUCCESS;
 }
 
 DEFPY(watch_nexthop_v4, watch_nexthop_v4_cmd,
-      "sharp watch nexthop A.B.C.D$nhop",
+      "sharp watch nexthop A.B.C.D$nhop [connected$connected]",
       "Sharp routing Protocol\n"
       "Watch for changes\n"
       "Watch for nexthop changes\n"
-      "The v4 nexthop to signal for watching\n")
+      "The v4 nexthop to signal for watching\n"
+      "Should the route be connected\n")
 {
        struct prefix p;
 
@@ -83,7 +85,7 @@ DEFPY(watch_nexthop_v4, watch_nexthop_v4_cmd,
        p.u.prefix4 = nhop;
        p.family = AF_INET;
 
-       sharp_zebra_nexthop_watch(&p, true);
+       sharp_zebra_nexthop_watch(&p, true, !!connected);
 
        return CMD_SUCCESS;
 }
index c9f333e34be84f3ec274db895f2be178fb208ea3..f6de086c0655399f3ba71e94ef1412cccd101874 100644 (file)
@@ -328,14 +328,14 @@ void route_delete(struct prefix *p, uint8_t instance)
        return;
 }
 
-void sharp_zebra_nexthop_watch(struct prefix *p, bool watch)
+void sharp_zebra_nexthop_watch(struct prefix *p, bool watch, bool connected)
 {
        int command = ZEBRA_NEXTHOP_REGISTER;
 
        if (!watch)
                command = ZEBRA_NEXTHOP_UNREGISTER;
 
-       if (zclient_send_rnh(zclient, command, p, true, VRF_DEFAULT) < 0)
+       if (zclient_send_rnh(zclient, command, p, connected, VRF_DEFAULT) < 0)
                zlog_warn("%s: Failure to send nexthop to zebra",
                          __PRETTY_FUNCTION__);
 }
index 7326056cae773e044dd9a6eed23ab97295a4ebf4..7e6ac7670bd9ad5c5aa0a3d503717974528b9272 100644 (file)
@@ -28,7 +28,8 @@ extern void vrf_label_add(vrf_id_t vrf_id, afi_t afi, mpls_label_t label);
 extern void route_add(struct prefix *p, uint8_t instance,
                      struct nexthop_group *nhg);
 extern void route_delete(struct prefix *p, uint8_t instance);
-extern void sharp_zebra_nexthop_watch(struct prefix *p, bool watch);
+extern void sharp_zebra_nexthop_watch(struct prefix *p, bool watch,
+                                     bool connected);
 
 extern void sharp_install_routes_helper(struct prefix *p, uint8_t instance,
                                         struct nexthop_group *nhg,