mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-27 13:06:51 +00:00
Merge pull request #2119 from qlyoung/fix-vtysh-no-write-config
vtysh: fix failure to write config w/o watchfrr
This commit is contained in:
commit
0f82c7b646
@ -2611,20 +2611,25 @@ DEFUN (vtysh_write_memory,
|
|||||||
/* If integrated frr.conf explicitely set. */
|
/* If integrated frr.conf explicitely set. */
|
||||||
if (want_config_integrated()) {
|
if (want_config_integrated()) {
|
||||||
ret = CMD_WARNING_CONFIG_FAILED;
|
ret = CMD_WARNING_CONFIG_FAILED;
|
||||||
|
|
||||||
|
/* first attempt to use watchfrr if it's available */
|
||||||
|
bool used_watchfrr = false;
|
||||||
|
|
||||||
for (i = 0; i < array_size(vtysh_client); i++)
|
for (i = 0; i < array_size(vtysh_client); i++)
|
||||||
if (vtysh_client[i].flag == VTYSH_WATCHFRR)
|
if (vtysh_client[i].flag == VTYSH_WATCHFRR)
|
||||||
break;
|
break;
|
||||||
if (i < array_size(vtysh_client) && vtysh_client[i].fd != -1)
|
if (i < array_size(vtysh_client) && vtysh_client[i].fd != -1) {
|
||||||
|
used_watchfrr = true;
|
||||||
ret = vtysh_client_execute(&vtysh_client[i],
|
ret = vtysh_client_execute(&vtysh_client[i],
|
||||||
"do write integrated",
|
"do write integrated",
|
||||||
outputfile);
|
outputfile);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If watchfrr returns CMD_WARNING_CONFIG_FAILED this means
|
* If we didn't use watchfrr, fallback to writing the config
|
||||||
* that it could not write the config, but additionally
|
* ourselves
|
||||||
* indicates that we should not try either
|
|
||||||
*/
|
*/
|
||||||
if (ret != CMD_SUCCESS && ret != CMD_WARNING_CONFIG_FAILED) {
|
if (!used_watchfrr) {
|
||||||
printf("\nWarning: attempting direct configuration write without "
|
printf("\nWarning: attempting direct configuration write without "
|
||||||
"watchfrr.\nFile permissions and ownership may be "
|
"watchfrr.\nFile permissions and ownership may be "
|
||||||
"incorrect, or write may fail.\n\n");
|
"incorrect, or write may fail.\n\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user