mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 14:34:22 +00:00
bgpd: forbid modification of bgp instance type
If a user issues the following commands: ``` router bgp 65000 vrf red router bgp 65000 view red ``` bgpd ends up having NB config inconsistent with actual data. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
parent
debb7b1931
commit
d3e3677096
@ -1483,12 +1483,27 @@ int bgp_global_global_config_timers_keepalive_modify(
|
|||||||
*/
|
*/
|
||||||
int bgp_global_instance_type_view_modify(struct nb_cb_modify_args *args)
|
int bgp_global_instance_type_view_modify(struct nb_cb_modify_args *args)
|
||||||
{
|
{
|
||||||
|
struct bgp *bgp;
|
||||||
|
|
||||||
switch (args->event) {
|
switch (args->event) {
|
||||||
case NB_EV_VALIDATE:
|
case NB_EV_VALIDATE:
|
||||||
|
/*
|
||||||
|
* Changing instance type is not allowed, but we must allow it
|
||||||
|
* once, when the BGP instance is created the first time.
|
||||||
|
* If the instance already exists - return the validation
|
||||||
|
* error.
|
||||||
|
*/
|
||||||
|
bgp = nb_running_get_entry_non_rec(args->dnode->parent->parent,
|
||||||
|
NULL, false);
|
||||||
|
if (bgp) {
|
||||||
|
snprintf(args->errmsg, args->errmsg_len,
|
||||||
|
"Changing instance type is not allowed");
|
||||||
|
return NB_ERR_VALIDATION;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case NB_EV_PREPARE:
|
case NB_EV_PREPARE:
|
||||||
case NB_EV_ABORT:
|
case NB_EV_ABORT:
|
||||||
case NB_EV_APPLY:
|
case NB_EV_APPLY:
|
||||||
/* TODO: implement me. */
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1388,6 +1388,10 @@ DEFUN_YANG_NOSH(router_bgp,
|
|||||||
nb_cli_enqueue_change(vty,
|
nb_cli_enqueue_change(vty,
|
||||||
"./global/instance-type-view",
|
"./global/instance-type-view",
|
||||||
NB_OP_MODIFY, "true");
|
NB_OP_MODIFY, "true");
|
||||||
|
} else {
|
||||||
|
nb_cli_enqueue_change(vty,
|
||||||
|
"./global/instance-type-view",
|
||||||
|
NB_OP_MODIFY, "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = nb_cli_apply_changes(vty, base_xpath);
|
ret = nb_cli_apply_changes(vty, base_xpath);
|
||||||
|
Loading…
Reference in New Issue
Block a user