summaryrefslogtreecommitdiffstats
path: root/sharpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2024-01-26 15:26:30 +0100
committerDonald Sharp <sharpd@nvidia.com>2024-01-26 15:26:30 +0100
commit3d97d2679f036722072fd078848604ca965f1037 (patch)
tree21346e75befa0753fc1a1e6588509fa9d32037a8 /sharpd
parentMerge pull request #15233 from louis-6wind/bgp-leak-no-network (diff)
downloadfrr-3d97d2679f036722072fd078848604ca965f1037.tar.xz
frr-3d97d2679f036722072fd078848604ca965f1037.zip
sharpd: Add ability to turn off watching of redistribution
Wanted to do some testing of redistribute without having to restart sharpd over and over. Added ability to turn off the `sharp watch redistribute XX` functionality. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'sharpd')
-rw-r--r--sharpd/sharp_vty.c5
-rw-r--r--sharpd/sharp_zebra.c7
-rw-r--r--sharpd/sharp_zebra.h2
3 files changed, 8 insertions, 6 deletions
diff --git a/sharpd/sharp_vty.c b/sharpd/sharp_vty.c
index 1df765614..07050ab93 100644
--- a/sharpd/sharp_vty.c
+++ b/sharpd/sharp_vty.c
@@ -54,7 +54,8 @@ DEFPY(watch_neighbor, watch_neighbor_cmd,
DEFPY(watch_redistribute, watch_redistribute_cmd,
- "sharp watch [vrf NAME$vrf_name] redistribute " FRR_REDIST_STR_SHARPD,
+ "[no] sharp watch [vrf NAME$vrf_name] redistribute " FRR_REDIST_STR_SHARPD,
+ NO_STR
"Sharp routing Protocol\n"
"Watch for changes\n"
"The vrf we would like to watch if non-default\n"
@@ -75,7 +76,7 @@ DEFPY(watch_redistribute, watch_redistribute_cmd,
}
source = proto_redistnum(AFI_IP, argv[argc-1]->text);
- sharp_redistribute_vrf(vrf, source);
+ sharp_redistribute_vrf(vrf, source, !no);
return CMD_SUCCESS;
}
diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c
index f4947540d..133da918f 100644
--- a/sharpd/sharp_zebra.c
+++ b/sharpd/sharp_zebra.c
@@ -704,10 +704,11 @@ static int sharp_redistribute_route(ZAPI_CALLBACK_ARGS)
return 0;
}
-void sharp_redistribute_vrf(struct vrf *vrf, int type)
+void sharp_redistribute_vrf(struct vrf *vrf, int type, bool turn_on)
{
- zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP, type,
- 0, vrf->vrf_id);
+ zebra_redistribute_send(turn_on ? ZEBRA_REDISTRIBUTE_ADD
+ : ZEBRA_REDISTRIBUTE_DELETE,
+ zclient, AFI_IP, type, 0, vrf->vrf_id);
}
static zclient_handler *const sharp_opaque_handlers[] = {
diff --git a/sharpd/sharp_zebra.h b/sharpd/sharp_zebra.h
index df80ce77a..5cbcc1466 100644
--- a/sharpd/sharp_zebra.h
+++ b/sharpd/sharp_zebra.h
@@ -55,7 +55,7 @@ extern void sharp_zebra_send_arp(const struct interface *ifp,
/* Register Link State Opaque messages */
extern void sharp_zebra_register_te(void);
-extern void sharp_redistribute_vrf(struct vrf *vrf, int source);
+extern void sharp_redistribute_vrf(struct vrf *vrf, int source, bool turn_on);
extern int sharp_zebra_srv6_manager_get_locator_chunk(const char *lname);
extern int sharp_zebra_srv6_manager_release_locator_chunk(const char *lname);