summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_affinitymap.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2024-01-19 00:40:21 +0100
committerIgor Ryzhov <iryzhov@nfware.com>2024-01-19 02:47:05 +0100
commit670e0c0737862e77f7baa042b2748345c13e7355 (patch)
tree6e83f6d2bb5c3b4e0e853ce58960818c54b6cd63 /zebra/zebra_affinitymap.c
parentlib: make affinity-map value unique in the yang model (diff)
downloadfrr-670e0c0737862e77f7baa042b2748345c13e7355.tar.xz
frr-670e0c0737862e77f7baa042b2748345c13e7355.zip
lib: validate affinity-map bit position using the yang model
When affinity mode is "standard", bit position cannot be greater than 31. Add a "must" statement to the YANG model to validate this, and remove our custom validation code that does the same. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'zebra/zebra_affinitymap.c')
-rw-r--r--zebra/zebra_affinitymap.c38
1 files changed, 0 insertions, 38 deletions
diff --git a/zebra/zebra_affinitymap.c b/zebra/zebra_affinitymap.c
index fabd3e677..dd0600003 100644
--- a/zebra/zebra_affinitymap.c
+++ b/zebra/zebra_affinitymap.c
@@ -26,43 +26,6 @@
#include "zebra/redistribute.h"
#include "zebra/zebra_affinitymap.h"
-static bool zebra_affinity_map_check_update(const char *affmap_name,
- uint16_t new_pos)
-{
- char xpath[XPATH_MAXLEN];
- struct interface *ifp;
- struct vrf *vrf;
-
- /* check whether the affinity-map new bit position is upper than 31
- * but is used on an interface on which affinity-mode is standard.
- * Return false if the change is not possible.
- */
- if (new_pos < 32)
- return true;
-
- 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))
- continue;
- if (yang_dnode_get_enum(
- running_config->dnode,
- "/frr-interface:lib/interface[name='%s']/frr-zebra:zebra/link-params/affinity-mode",
- ifp->name) == AFFINITY_MODE_STANDARD)
- return false;
- }
- }
- return true;
-}
-
static void zebra_affinity_map_update(const char *affmap_name, uint16_t old_pos,
uint16_t new_pos)
{
@@ -114,6 +77,5 @@ void zebra_affinity_map_init(void)
{
affinity_map_init();
- affinity_map_set_check_update_hook(zebra_affinity_map_check_update);
affinity_map_set_update_hook(zebra_affinity_map_update);
}