mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 07:27:09 +00:00
Merge pull request #13005 from donaldsharp/prefix_list_speedup
lib: Speedup prefix-list readin by a large factor
This commit is contained in:
commit
d4906f8b6d
@ -1272,9 +1272,6 @@ DEFPY_YANG(
|
||||
pda.any = true;
|
||||
}
|
||||
|
||||
if (plist_is_dup(vty->candidate_config->dnode, &pda))
|
||||
return CMD_SUCCESS;
|
||||
|
||||
/*
|
||||
* Create the prefix-list first, so we can generate sequence if
|
||||
* none given (backward compatibility).
|
||||
@ -1476,9 +1473,6 @@ DEFPY_YANG(
|
||||
pda.any = true;
|
||||
}
|
||||
|
||||
if (plist_is_dup(vty->candidate_config->dnode, &pda))
|
||||
return CMD_SUCCESS;
|
||||
|
||||
/*
|
||||
* Create the prefix-list first, so we can generate sequence if
|
||||
* none given (backward compatibility).
|
||||
|
@ -456,24 +456,6 @@ bool plist_is_dup(const struct lyd_node *dnode, struct plist_dup_args *pda)
|
||||
return pda->pda_found;
|
||||
}
|
||||
|
||||
static bool plist_is_dup_nb(const struct lyd_node *dnode)
|
||||
{
|
||||
const struct lyd_node *entry_dnode =
|
||||
yang_dnode_get_parent(dnode, "entry");
|
||||
struct plist_dup_args pda = {};
|
||||
|
||||
/* Initialize. */
|
||||
pda.pda_type = yang_dnode_get_string(entry_dnode, "../type");
|
||||
pda.pda_name = yang_dnode_get_string(entry_dnode, "../name");
|
||||
pda.pda_action = yang_dnode_get_string(entry_dnode, "action");
|
||||
pda.pda_entry_dnode = entry_dnode;
|
||||
|
||||
plist_dnode_to_prefix(entry_dnode, &pda.any, &pda.prefix, &pda.ge,
|
||||
&pda.le);
|
||||
|
||||
return plist_is_dup(entry_dnode, &pda);
|
||||
}
|
||||
|
||||
/*
|
||||
* XPath: /frr-filter:lib/access-list
|
||||
*/
|
||||
@ -1331,13 +1313,6 @@ lib_prefix_list_entry_ipv4_prefix_modify(struct nb_cb_modify_args *args)
|
||||
const struct lyd_node *plist_dnode =
|
||||
yang_dnode_get_parent(args->dnode, "prefix-list");
|
||||
|
||||
if (plist_is_dup_nb(args->dnode)) {
|
||||
snprintf(args->errmsg, args->errmsg_len,
|
||||
"duplicated prefix list value: %s",
|
||||
yang_dnode_get_string(args->dnode, NULL));
|
||||
return NB_ERR_VALIDATION;
|
||||
}
|
||||
|
||||
return prefix_list_nb_validate_v4_af_type(
|
||||
plist_dnode, args->errmsg, args->errmsg_len);
|
||||
}
|
||||
@ -1366,13 +1341,6 @@ lib_prefix_list_entry_ipv6_prefix_modify(struct nb_cb_modify_args *args)
|
||||
const struct lyd_node *plist_dnode =
|
||||
yang_dnode_get_parent(args->dnode, "prefix-list");
|
||||
|
||||
if (plist_is_dup_nb(args->dnode)) {
|
||||
snprintf(args->errmsg, args->errmsg_len,
|
||||
"duplicated prefix list value: %s",
|
||||
yang_dnode_get_string(args->dnode, NULL));
|
||||
return NB_ERR_VALIDATION;
|
||||
}
|
||||
|
||||
return prefix_list_nb_validate_v6_af_type(
|
||||
plist_dnode, args->errmsg, args->errmsg_len);
|
||||
}
|
||||
@ -1404,13 +1372,6 @@ static int lib_prefix_list_entry_ipv4_prefix_length_greater_or_equal_modify(
|
||||
const struct lyd_node *plist_dnode =
|
||||
yang_dnode_get_parent(args->dnode, "prefix-list");
|
||||
|
||||
if (plist_is_dup_nb(args->dnode)) {
|
||||
snprintf(args->errmsg, args->errmsg_len,
|
||||
"duplicated prefix list value: %s",
|
||||
yang_dnode_get_string(args->dnode, NULL));
|
||||
return NB_ERR_VALIDATION;
|
||||
}
|
||||
|
||||
return prefix_list_nb_validate_v4_af_type(
|
||||
plist_dnode, args->errmsg, args->errmsg_len);
|
||||
}
|
||||
@ -1448,13 +1409,6 @@ static int lib_prefix_list_entry_ipv4_prefix_length_lesser_or_equal_modify(
|
||||
const struct lyd_node *plist_dnode =
|
||||
yang_dnode_get_parent(args->dnode, "prefix-list");
|
||||
|
||||
if (plist_is_dup_nb(args->dnode)) {
|
||||
snprintf(args->errmsg, args->errmsg_len,
|
||||
"duplicated prefix list value: %s",
|
||||
yang_dnode_get_string(args->dnode, NULL));
|
||||
return NB_ERR_VALIDATION;
|
||||
}
|
||||
|
||||
return prefix_list_nb_validate_v4_af_type(
|
||||
plist_dnode, args->errmsg, args->errmsg_len);
|
||||
}
|
||||
@ -1492,13 +1446,6 @@ static int lib_prefix_list_entry_ipv6_prefix_length_greater_or_equal_modify(
|
||||
const struct lyd_node *plist_dnode =
|
||||
yang_dnode_get_parent(args->dnode, "prefix-list");
|
||||
|
||||
if (plist_is_dup_nb(args->dnode)) {
|
||||
snprintf(args->errmsg, args->errmsg_len,
|
||||
"duplicated prefix list value: %s",
|
||||
yang_dnode_get_string(args->dnode, NULL));
|
||||
return NB_ERR_VALIDATION;
|
||||
}
|
||||
|
||||
return prefix_list_nb_validate_v6_af_type(
|
||||
plist_dnode, args->errmsg, args->errmsg_len);
|
||||
}
|
||||
@ -1536,13 +1483,6 @@ static int lib_prefix_list_entry_ipv6_prefix_length_lesser_or_equal_modify(
|
||||
const struct lyd_node *plist_dnode =
|
||||
yang_dnode_get_parent(args->dnode, "prefix-list");
|
||||
|
||||
if (plist_is_dup_nb(args->dnode)) {
|
||||
snprintf(args->errmsg, args->errmsg_len,
|
||||
"duplicated prefix list value: %s",
|
||||
yang_dnode_get_string(args->dnode, NULL));
|
||||
return NB_ERR_VALIDATION;
|
||||
}
|
||||
|
||||
return prefix_list_nb_validate_v6_af_type(
|
||||
plist_dnode, args->errmsg, args->errmsg_len);
|
||||
}
|
||||
@ -1574,16 +1514,11 @@ static int lib_prefix_list_entry_any_create(struct nb_cb_create_args *args)
|
||||
struct prefix_list_entry *ple;
|
||||
int type;
|
||||
|
||||
if (args->event == NB_EV_VALIDATE) {
|
||||
if (plist_is_dup_nb(args->dnode)) {
|
||||
snprintf(args->errmsg, args->errmsg_len,
|
||||
"duplicated prefix list value: %s",
|
||||
yang_dnode_get_string(args->dnode, NULL));
|
||||
return NB_ERR_VALIDATION;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we have gotten to this point, it's legal
|
||||
*/
|
||||
if (args->event == NB_EV_VALIDATE)
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
if (args->event != NB_EV_APPLY)
|
||||
return NB_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user