diff options
| author | Pushpasis Sarkar <pushpasis.frr@gmail.com> | 2023-03-14 03:36:06 -0700 |
|---|---|---|
| committer | Christian Hopps <chopps@gmail.com> | 2023-03-22 05:22:56 +0000 |
| commit | 1401ee8bf74b7688ca5f5bdfc3411734e9f0cb3b (patch) | |
| tree | 04c63358d2e90417cf95dd0eee6968a3f9c08521 /lib/northbound_cli.c | |
| parent | f82370b47bddb214d53ffb94775805d637300e9b (diff) | |
lib, mgmtd: Add few fixes for commit-check and rollback
This commit contains fixes for the following issues found
- 'mgmt commit check' issued through 'vtysh -f' was actually commtting the changeset.
- On config validation failure backend, mgmtd was not passing the correct error-reason
to frontend.
- 'mgmt rollback ...' was reverting the change on backend, but config on mgmtd daemon
remains intact
Signed-off-by: Pushpasis Sarkar <pushpasis@gmail.com>
Diffstat (limited to 'lib/northbound_cli.c')
| -rw-r--r-- | lib/northbound_cli.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/northbound_cli.c b/lib/northbound_cli.c index 523b383c62..281d9a4704 100644 --- a/lib/northbound_cli.c +++ b/lib/northbound_cli.c @@ -183,6 +183,8 @@ static int nb_cli_apply_changes_internal(struct vty *vty, int nb_cli_apply_changes(struct vty *vty, const char *xpath_base_fmt, ...) { char xpath_base[XPATH_MAXLEN] = {}; + bool implicit_commit; + int ret; /* Parse the base XPath format string. */ if (xpath_base_fmt) { @@ -195,7 +197,12 @@ int nb_cli_apply_changes(struct vty *vty, const char *xpath_base_fmt, ...) if (vty_mgmt_fe_enabled()) { VTY_CHECK_XPATH; - return vty_mgmt_send_config_data(vty); + + implicit_commit = vty_needs_implicit_commit(vty); + ret = vty_mgmt_send_config_data(vty); + if (ret >= 0 && !implicit_commit) + vty->mgmt_num_pending_setcfg++; + return ret; } return nb_cli_apply_changes_internal(vty, xpath_base, false); @@ -205,6 +212,8 @@ int nb_cli_apply_changes_clear_pending(struct vty *vty, const char *xpath_base_fmt, ...) { char xpath_base[XPATH_MAXLEN] = {}; + bool implicit_commit; + int ret; /* Parse the base XPath format string. */ if (xpath_base_fmt) { @@ -217,7 +226,12 @@ int nb_cli_apply_changes_clear_pending(struct vty *vty, if (vty_mgmt_fe_enabled()) { VTY_CHECK_XPATH; - return vty_mgmt_send_config_data(vty); + + implicit_commit = vty_needs_implicit_commit(vty); + ret = vty_mgmt_send_config_data(vty); + if (ret >= 0 && !implicit_commit) + vty->mgmt_num_pending_setcfg++; + return ret; } return nb_cli_apply_changes_internal(vty, xpath_base, true); |
