forked from Mirror/frr
lib: fix prefix-list entry update
When a prefix-list entry is updated, current NB code calls the replacement code multiple times, once per each updated field. It means that when multiple fields of an entry are changed in a single commit, the replacement is done with an interim state of a prefix-list instead of a final one. To fix the issue, we should call the replacement code once, after all fields of an entry are updated. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
parent
a9460ae713
commit
0bc2ab8598
|
@ -136,9 +136,6 @@ static int lib_prefix_list_entry_prefix_length_greater_or_equal_modify(
|
||||||
|
|
||||||
ple->ge = yang_dnode_get_uint8(args->dnode, NULL);
|
ple->ge = yang_dnode_get_uint8(args->dnode, NULL);
|
||||||
|
|
||||||
/* Finish prefix entry update procedure. */
|
|
||||||
prefix_list_entry_update_finish(ple);
|
|
||||||
|
|
||||||
return NB_OK;
|
return NB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,9 +154,6 @@ static int lib_prefix_list_entry_prefix_length_lesser_or_equal_modify(
|
||||||
|
|
||||||
ple->le = yang_dnode_get_uint8(args->dnode, NULL);
|
ple->le = yang_dnode_get_uint8(args->dnode, NULL);
|
||||||
|
|
||||||
/* Finish prefix entry update procedure. */
|
|
||||||
prefix_list_entry_update_finish(ple);
|
|
||||||
|
|
||||||
return NB_OK;
|
return NB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,9 +172,6 @@ static int lib_prefix_list_entry_prefix_length_greater_or_equal_destroy(
|
||||||
|
|
||||||
ple->ge = 0;
|
ple->ge = 0;
|
||||||
|
|
||||||
/* Finish prefix entry update procedure. */
|
|
||||||
prefix_list_entry_update_finish(ple);
|
|
||||||
|
|
||||||
return NB_OK;
|
return NB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,9 +190,6 @@ static int lib_prefix_list_entry_prefix_length_lesser_or_equal_destroy(
|
||||||
|
|
||||||
ple->le = 0;
|
ple->le = 0;
|
||||||
|
|
||||||
/* Finish prefix entry update procedure. */
|
|
||||||
prefix_list_entry_update_finish(ple);
|
|
||||||
|
|
||||||
return NB_OK;
|
return NB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1229,6 +1217,22 @@ static int lib_prefix_list_entry_destroy(struct nb_cb_destroy_args *args)
|
||||||
return NB_OK;
|
return NB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
lib_prefix_list_entry_apply_finish(struct nb_cb_apply_finish_args *args)
|
||||||
|
{
|
||||||
|
struct prefix_list_entry *ple;
|
||||||
|
|
||||||
|
ple = nb_running_get_entry(args->dnode, NULL, true);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Finish prefix entry update procedure. The procedure is started in
|
||||||
|
* children callbacks. `prefix_list_entry_update_start` can be called
|
||||||
|
* multiple times if multiple children are modified, but it is actually
|
||||||
|
* executed only once because of the protection by `ple->installed`.
|
||||||
|
*/
|
||||||
|
prefix_list_entry_update_finish(ple);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPath: /frr-filter:lib/prefix-list/entry/action
|
* XPath: /frr-filter:lib/prefix-list/entry/action
|
||||||
*/
|
*/
|
||||||
|
@ -1251,9 +1255,6 @@ static int lib_prefix_list_entry_action_modify(struct nb_cb_modify_args *args)
|
||||||
else
|
else
|
||||||
ple->type = PREFIX_DENY;
|
ple->type = PREFIX_DENY;
|
||||||
|
|
||||||
/* Finish prefix entry update procedure. */
|
|
||||||
prefix_list_entry_update_finish(ple);
|
|
||||||
|
|
||||||
return NB_OK;
|
return NB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1281,10 +1282,6 @@ static int lib_prefix_list_entry_prefix_modify(struct nb_cb_modify_args *args)
|
||||||
prefix_copy(&ple->prefix, &p);
|
prefix_copy(&ple->prefix, &p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Finish prefix entry update procedure. */
|
|
||||||
prefix_list_entry_update_finish(ple);
|
|
||||||
|
|
||||||
return NB_OK;
|
return NB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1302,9 +1299,6 @@ static int lib_prefix_list_entry_prefix_destroy(struct nb_cb_destroy_args *args)
|
||||||
|
|
||||||
memset(&ple->prefix, 0, sizeof(ple->prefix));
|
memset(&ple->prefix, 0, sizeof(ple->prefix));
|
||||||
|
|
||||||
/* Finish prefix entry update procedure. */
|
|
||||||
prefix_list_entry_update_finish(ple);
|
|
||||||
|
|
||||||
return NB_OK;
|
return NB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1552,9 +1546,6 @@ static int lib_prefix_list_entry_any_create(struct nb_cb_create_args *args)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Finish prefix entry update procedure. */
|
|
||||||
prefix_list_entry_update_finish(ple);
|
|
||||||
|
|
||||||
return NB_OK;
|
return NB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1572,9 +1563,6 @@ static int lib_prefix_list_entry_any_destroy(struct nb_cb_destroy_args *args)
|
||||||
|
|
||||||
ple->any = false;
|
ple->any = false;
|
||||||
|
|
||||||
/* Finish prefix entry update procedure. */
|
|
||||||
prefix_list_entry_update_finish(ple);
|
|
||||||
|
|
||||||
return NB_OK;
|
return NB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1741,6 +1729,7 @@ const struct frr_yang_module_info frr_filter_info = {
|
||||||
.cbs = {
|
.cbs = {
|
||||||
.create = lib_prefix_list_entry_create,
|
.create = lib_prefix_list_entry_create,
|
||||||
.destroy = lib_prefix_list_entry_destroy,
|
.destroy = lib_prefix_list_entry_destroy,
|
||||||
|
.apply_finish = lib_prefix_list_entry_apply_finish,
|
||||||
.cli_cmp = prefix_list_cmp,
|
.cli_cmp = prefix_list_cmp,
|
||||||
.cli_show = prefix_list_show,
|
.cli_show = prefix_list_show,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue