summaryrefslogtreecommitdiff
path: root/zebra/zebra_affinitymap.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2024-01-18 23:27:56 +0200
committerIgor Ryzhov <iryzhov@nfware.com>2024-01-19 03:46:56 +0200
commitfdd834b8cc69b1b8c9bdfcfa1f033f35affb4c09 (patch)
treee583ef8ad991140ef214508d1f50ec8cc93e25a9 /zebra/zebra_affinitymap.c
parent6103c6251ac7986cda4d538d25efc5fcc2b6d1c7 (diff)
lib: validate affinity-map reference using yang model
Change the type of affinity leaf-list in frr-zebra to a leafref with "require-instance" property set to true. This change tells libyang to automatically check that affinity-map exists before usage and doesn't allow it to be deleted if it's referenced. It allows us to remove all the manual code that is doing the same thing. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'zebra/zebra_affinitymap.c')
-rw-r--r--zebra/zebra_affinitymap.c25
1 files changed, 0 insertions, 25 deletions
diff --git a/zebra/zebra_affinitymap.c b/zebra/zebra_affinitymap.c
index ae0f9a8a35..fabd3e677c 100644
--- a/zebra/zebra_affinitymap.c
+++ b/zebra/zebra_affinitymap.c
@@ -26,30 +26,6 @@
#include "zebra/redistribute.h"
#include "zebra/zebra_affinitymap.h"
-static bool zebra_affinity_map_check_use(const char *affmap_name)
-{
- char xpath[XPATH_MAXLEN];
- struct interface *ifp;
- struct vrf *vrf;
-
- RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
- FOR_ALL_INTERFACES (vrf, ifp) {
- snprintf(xpath, sizeof(xpath),
- "/frr-interface:lib/interface[name='%s']",
- ifp->name);
- if (!yang_dnode_exists(running_config->dnode, xpath))
- continue;
- snprintf(
- xpath, sizeof(xpath),
- "/frr-interface:lib/interface[name='%s']/frr-zebra:zebra/link-params/affinities[affinity='%s']",
- ifp->name, affmap_name);
- if (yang_dnode_exists(running_config->dnode, xpath))
- return true;
- }
- }
- return false;
-}
-
static bool zebra_affinity_map_check_update(const char *affmap_name,
uint16_t new_pos)
{
@@ -138,7 +114,6 @@ void zebra_affinity_map_init(void)
{
affinity_map_init();
- affinity_map_set_check_use_hook(zebra_affinity_map_check_use);
affinity_map_set_check_update_hook(zebra_affinity_map_check_update);
affinity_map_set_update_hook(zebra_affinity_map_update);
}