diff options
| author | Igor Ryzhov <iryzhov@nfware.com> | 2021-10-13 18:30:06 +0300 | 
|---|---|---|
| committer | Igor Ryzhov <iryzhov@nfware.com> | 2021-10-25 15:31:07 +0300 | 
| commit | 104fd767383a042baff0eff8f3988d3a95123eda (patch) | |
| tree | 0d37d85d14d727078fb4fdfecf4a677ad5e37b4e /lib/if.c | |
| parent | 6f354338f98c173dc9cdc9165c03acdf5fc5685e (diff) | |
*: fix interface config write in NB-converted daemons
When writing the config from the NB-converted daemon, we must not rely
on the operational data. This commit changes the output of the interface
configuration to use only config data. As the code is the same for all
daemons, move it to the lib and remove all the duplicated code.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'lib/if.c')
| -rw-r--r-- | lib/if.c | 19 | 
1 files changed, 19 insertions, 0 deletions
@@ -1341,6 +1341,20 @@ static struct cmd_node interface_node = {  	.prompt = "%s(config-if)# ",  }; +static int if_config_write_single(const struct lyd_node *dnode, void *arg) +{ +	nb_cli_show_dnode_cmds(arg, dnode, false); + +	return YANG_ITER_CONTINUE; +} + +static int if_nb_config_write(struct vty *vty) +{ +	yang_dnode_iterate(if_config_write_single, vty, running_config->dnode, +			   "/frr-interface:lib/interface"); +	return 1; +} +  void if_cmd_init(int (*config_write)(struct vty *))  {  	cmd_variable_handler_register(if_var_handlers); @@ -1356,6 +1370,11 @@ void if_cmd_init(int (*config_write)(struct vty *))  	install_element(INTERFACE_NODE, &no_interface_desc_cmd);  } +void if_cmd_init_default(void) +{ +	if_cmd_init(if_nb_config_write); +} +  void if_zapi_callbacks(int (*create)(struct interface *ifp),  		       int (*up)(struct interface *ifp),  		       int (*down)(struct interface *ifp),  | 
