diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2017-03-23 14:49:28 -0300 |
|---|---|---|
| committer | Renato Westphal <renato@opensourcerouting.org> | 2017-03-27 14:54:28 -0300 |
| commit | 56b8a8d231bf36a7011eb97eb115a148b3395635 (patch) | |
| tree | 6779b393c0a44a9acbd7013e505e6379e8df191e /lib/sigevent.c | |
| parent | 83139e57e96493d00cf46c403845c45b6ef2a37c (diff) | |
ldpd: simplify handling of configuration commands
The logic to make configuration changes in ldpd is as follows:
1 - duplicate the current configuration;
2 - modify the duplicated configuration (delta);
3 - merge the duplicated configuration into the current configuration.
We can however change things a little bit in order to simplify the code.
If we provide a global vty_conf variable and make sure that it's
always an up-to-date duplicate of ldpd_conf, then we don't need to call
ldp_dup_config() in the callback of each configuration command. Instead
of that, we just need to duplicate ldpd_conf in the startup of the daemon
and in the end of the ldp_reload() function. Doing this is safe because,
due to the single-threaded nature of the parent process, it's impossible
to have multiple requests to change the configuration at the same time.
Also, we can remove the *_ref() functions and do something much simpler
instead. The problem we have to deal with here is that VTY_GET_CONTEXT()
returns a pointer to an element of ldpd_conf, and what we want is a
pointer to an element of vty_conf (e.g. an l2vpn). To solve this,
we just need to look for the equivalent element inside vty_conf using
standard functions from ldpd like l2vpn_find() and others.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/sigevent.c')
0 files changed, 0 insertions, 0 deletions
