mirror of https://gerrit.osmocom.org/libosmocore
vty: Check with the application before writing the config
For the BSC/NITB application we see that people modify the band without modifying the ARFCN. This creates an unbootable config. Using the new hook the BSC/NITB can check if the config is consistent and prevent the config file being written. Related: SYS#739
This commit is contained in:
parent
e15ac060e7
commit
9f0f978c8d
|
@ -1,2 +1,3 @@
|
||||||
#library what description / commit summary line
|
#library what description / commit summary line
|
||||||
libosmocore abi-change logging: Add ability to save/print current log filters
|
libosmocore abi-change logging: Add ability to save/print current log filters
|
||||||
|
libosmovty abi-change vty: Check with the application before writing the config
|
||||||
|
|
|
@ -159,6 +159,8 @@ struct vty_app_info {
|
||||||
enum node_type (*go_parent_cb)(struct vty *vty);
|
enum node_type (*go_parent_cb)(struct vty *vty);
|
||||||
/*! \brief call-back to determine if node is config node */
|
/*! \brief call-back to determine if node is config node */
|
||||||
int (*is_config_node)(struct vty *vty, int node);
|
int (*is_config_node)(struct vty *vty, int node);
|
||||||
|
/*! \brief Check if the config is consistent before write */
|
||||||
|
int (*config_is_consistent)(struct vty *vty);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Prototypes. */
|
/* Prototypes. */
|
||||||
|
|
|
@ -2497,6 +2497,15 @@ DEFUN(config_write_file,
|
||||||
char *failed_file;
|
char *failed_file;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
if (host.app_info->config_is_consistent) {
|
||||||
|
rc = host.app_info->config_is_consistent(vty);
|
||||||
|
if (!rc) {
|
||||||
|
vty_out(vty, "Configuration is not consistent%s",
|
||||||
|
VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (host.config == NULL) {
|
if (host.config == NULL) {
|
||||||
vty_out(vty, "Can't save to configuration file, using vtysh.%s",
|
vty_out(vty, "Can't save to configuration file, using vtysh.%s",
|
||||||
VTY_NEWLINE);
|
VTY_NEWLINE);
|
||||||
|
|
Loading…
Reference in New Issue