ripd: fix SIGHUP handling

We can now leverage the new northbound API to perform a full configuration
reload in ripd without the need for external help (i.e. frr-reload.py).

When vty_read_config() is called with the 'config' parameter set to
NULL, it performs a new configuration transaction where the running
configuration is *replaced* by the provided configuration file. With that
said, we don't need to do anything other than calling this function in
the SIGHUP handler of all FRR daemons. If a daemon hasn't been converted
to the new northbound model, vty_read_config() will simply *merge*
the configuration file into the running configuration.

The calls to rip_clean() and rip_reset() in the SIGUP handler were
changing configuration variables directly, bypassing the northbound
layer. Configuration variables should be changed only by the northbound
callbacks, and failure to respect that inevitably leads to inconsistencies
and crashes. Fix this.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
Renato Westphal 2018-07-01 22:24:29 -03:00
parent 72010aca15
commit bc1bdde2f6
3 changed files with 0 additions and 30 deletions

View File

@ -71,14 +71,9 @@ static struct frr_daemon_info ripd_di;
static void sighup(void)
{
zlog_info("SIGHUP received");
rip_clean();
rip_reset();
zlog_info("ripd restarting!");
/* Reload config file. */
vty_read_config(NULL, ripd_di.config_file, config_default);
/* Try to return to normal operation. */
}
/* SIGINT handler. */

View File

@ -3374,30 +3374,6 @@ void rip_clean(void)
rip_redistribute_clean();
}
/* Reset all values to the default settings. */
void rip_reset(void)
{
/* Reset global counters. */
rip_global_route_changes = 0;
rip_global_queries = 0;
/* Call ripd related reset functions. */
rip_debug_reset();
rip_route_map_reset();
/* Call library reset functions. */
vty_reset();
access_list_reset();
prefix_list_reset();
distribute_list_reset();
rip_interfaces_reset();
rip_distance_reset();
rip_zclient_reset();
}
static void rip_if_rmap_update(struct if_rmap *if_rmap)
{
struct interface *ifp;

View File

@ -373,7 +373,6 @@ struct rip_offset_list {
/* Prototypes. */
extern void rip_init(void);
extern void rip_reset(void);
extern void rip_clean(void);
extern void rip_clean_network(void);
extern void rip_interfaces_clean(void);