From 91529dc88d20394b64488ade43ec48454f5eb7c6 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 28 Feb 2019 08:12:32 -0500 Subject: [PATCH] sharpd: Add ability to pass vrf we want to watch Add the ability for the sharp zebra code to pass down the vrf that we want to watch. At this point in time, we cannot use it. Signed-off-by: Donald Sharp --- sharpd/sharp_vty.c | 6 ++++-- sharpd/sharp_zebra.c | 4 ++-- sharpd/sharp_zebra.h | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sharpd/sharp_vty.c b/sharpd/sharp_vty.c index 21fa3cf74..74550d82d 100644 --- a/sharpd/sharp_vty.c +++ b/sharpd/sharp_vty.c @@ -63,7 +63,8 @@ DEFPY(watch_nexthop_v6, watch_nexthop_v6_cmd, p.family = AF_INET6; sharp_nh_tracker_get(&p); - sharp_zebra_nexthop_watch(&p, type_import, true, !!connected); + sharp_zebra_nexthop_watch(&p, VRF_DEFAULT, type_import, + true, !!connected); return CMD_SUCCESS; } @@ -92,7 +93,8 @@ DEFPY(watch_nexthop_v4, watch_nexthop_v4_cmd, p.family = AF_INET; sharp_nh_tracker_get(&p); - sharp_zebra_nexthop_watch(&p, type_import, true, !!connected); + sharp_zebra_nexthop_watch(&p, VRF_DEFAULT, type_import, + true, !!connected); return CMD_SUCCESS; } diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c index 942040b80..f1e83628c 100644 --- a/sharpd/sharp_zebra.c +++ b/sharpd/sharp_zebra.c @@ -323,7 +323,7 @@ void route_delete(struct prefix *p, vrf_id_t vrf_id, uint8_t instance) return; } -void sharp_zebra_nexthop_watch(struct prefix *p, bool import, +void sharp_zebra_nexthop_watch(struct prefix *p, vrf_id_t vrf_id, bool import, bool watch, bool connected) { int command; @@ -340,7 +340,7 @@ void sharp_zebra_nexthop_watch(struct prefix *p, bool import, command = ZEBRA_IMPORT_ROUTE_UNREGISTER; } - if (zclient_send_rnh(zclient, command, p, connected, VRF_DEFAULT) < 0) + if (zclient_send_rnh(zclient, command, p, connected, vrf_id) < 0) zlog_warn("%s: Failure to send nexthop to zebra", __PRETTY_FUNCTION__); } diff --git a/sharpd/sharp_zebra.h b/sharpd/sharp_zebra.h index 7c3c39c89..57ffcc769 100644 --- a/sharpd/sharp_zebra.h +++ b/sharpd/sharp_zebra.h @@ -28,8 +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, vrf_id_t, uint8_t instance, struct nexthop_group *nhg); extern void route_delete(struct prefix *p, vrf_id_t vrf_id, uint8_t instance); -extern void sharp_zebra_nexthop_watch(struct prefix *p, bool import, - bool watch, bool connected); +extern void sharp_zebra_nexthop_watch(struct prefix *p, vrf_id_t vrf_id, + bool import, bool watch, bool connected); extern void sharp_install_routes_helper(struct prefix *p, vrf_id_t vrf_id, uint8_t instance, -- 2.39.2