Merge pull request #770 from donaldsharp/zclient

Zclient
This commit is contained in:
Jafar Al-Gharaibeh 2017-06-30 10:35:28 -05:00 committed by GitHub
commit 1d0ca3ebf3
17 changed files with 52 additions and 4 deletions

View File

@ -400,4 +400,5 @@ void
babel_zebra_close_connexion(void) babel_zebra_close_connexion(void)
{ {
zclient_stop(zclient); zclient_stop(zclient);
zclient_free(zclient);
} }

View File

@ -267,8 +267,10 @@ eigrp_finish (struct eigrp *eigrp)
&& (listcount(eigrp_om->eigrp) == 0)) && (listcount(eigrp_om->eigrp) == 0))
{ {
if (zclient) if (zclient)
{
zclient_stop (zclient);
zclient_free (zclient); zclient_free (zclient);
}
exit(0); exit(0);
} }

View File

@ -101,6 +101,7 @@ void sigusr1(void);
static __attribute__((__noreturn__)) void static __attribute__((__noreturn__)) void
terminate (int i) terminate (int i)
{ {
isis_zebra_stop ();
exit (i); exit (i);
} }

View File

@ -720,3 +720,10 @@ isis_zebra_init (struct thread_master *master)
return; return;
} }
void
isis_zebra_stop (void)
{
zclient_stop (zclient);
zclient_free (zclient);
}

View File

@ -25,6 +25,8 @@
extern struct zclient *zclient; extern struct zclient *zclient;
void isis_zebra_init(struct thread_master *); void isis_zebra_init(struct thread_master *);
void isis_zebra_stop(void);
void isis_zebra_route_update (struct prefix *prefix, void isis_zebra_route_update (struct prefix *prefix,
struct isis_route_info *route_info); struct isis_route_info *route_info);
int isis_distribute_list_update (int routetype); int isis_distribute_list_update (int routetype);

View File

@ -1320,7 +1320,7 @@ thread_fetch (struct thread_master *m, struct thread *fetch)
struct timeval now; struct timeval now;
struct timeval zerotime = { 0, 0 }; struct timeval zerotime = { 0, 0 };
struct timeval tv; struct timeval tv;
struct timeval *tw; struct timeval *tw = NULL;
int num = 0; int num = 0;

View File

@ -379,6 +379,7 @@ void nhrp_zebra_init(void)
void nhrp_zebra_terminate(void) void nhrp_zebra_terminate(void)
{ {
zclient_stop(zclient); zclient_stop(zclient);
zclient_free(zclient);
route_table_finish(zebra_rib[AFI_IP]); route_table_finish(zebra_rib[AFI_IP]);
route_table_finish(zebra_rib[AFI_IP6]); route_table_finish(zebra_rib[AFI_IP6]);
} }

View File

@ -110,7 +110,10 @@ ospf6_exit (int status)
cmd_terminate (); cmd_terminate ();
if (zclient) if (zclient)
{
zclient_stop (zclient);
zclient_free (zclient); zclient_free (zclient);
}
if (master) if (master)
thread_master_free (master); thread_master_free (master);

View File

@ -497,6 +497,8 @@ ospf_terminate (void)
* One or more ospf_finish()'s may have deferred shutdown to a timer * One or more ospf_finish()'s may have deferred shutdown to a timer
* thread * thread
*/ */
zclient_stop (zclient);
zclient_free (zclient);
} }
void void

View File

@ -115,6 +115,7 @@ static void zclient_lookup_failed(struct zclient *zlookup)
void void
zclient_lookup_free (void) zclient_lookup_free (void)
{ {
zclient_stop (zlookup);
zclient_free (zlookup); zclient_free (zlookup);
zlookup = NULL; zlookup = NULL;
} }

View File

@ -313,6 +313,8 @@ void pim_init()
void pim_terminate() void pim_terminate()
{ {
struct zclient *zclient;
pim_free(); pim_free();
/* reverse prefix_list_init */ /* reverse prefix_list_init */
@ -321,4 +323,11 @@ void pim_terminate()
prefix_list_reset (); prefix_list_reset ();
pim_vrf_terminate (); pim_vrf_terminate ();
zclient = pim_zebra_zclient_get ();
if (zclient)
{
zclient_stop (zclient);
zclient_free (zclient);
}
} }

View File

@ -100,6 +100,8 @@ sigint (void)
if (! retain_mode) if (! retain_mode)
rip_clean (); rip_clean ();
rip_zclient_stop ();
exit (0); exit (0);
} }

View File

@ -711,3 +711,10 @@ rip_zclient_init (struct thread_master *master)
install_element (RIP_NODE, &rip_default_information_originate_cmd); install_element (RIP_NODE, &rip_default_information_originate_cmd);
install_element (RIP_NODE, &no_rip_default_information_originate_cmd); install_element (RIP_NODE, &no_rip_default_information_originate_cmd);
} }
void
rip_zclient_stop (void)
{
zclient_stop (zclient);
zclient_free (zclient);
}

View File

@ -388,6 +388,7 @@ extern void rip_if_down_all (void);
extern void rip_route_map_init (void); extern void rip_route_map_init (void);
extern void rip_route_map_reset (void); extern void rip_route_map_reset (void);
extern void rip_zclient_init(struct thread_master *); extern void rip_zclient_init(struct thread_master *);
extern void rip_zclient_stop(void);
extern void rip_zclient_reset (void); extern void rip_zclient_reset (void);
extern void rip_offset_init (void); extern void rip_offset_init (void);
extern int if_check_address (struct in_addr addr); extern int if_check_address (struct in_addr addr);

View File

@ -103,6 +103,7 @@ sigint (void)
if (! retain_mode) if (! retain_mode)
ripng_clean (); ripng_clean ();
ripng_zebra_stop ();
exit (0); exit (0);
} }

View File

@ -557,3 +557,10 @@ zebra_init (struct thread_master *master)
install_element (RIPNG_NODE, &ripng_redistribute_type_metric_routemap_cmd); install_element (RIPNG_NODE, &ripng_redistribute_type_metric_routemap_cmd);
install_element (RIPNG_NODE, &no_ripng_redistribute_type_cmd); install_element (RIPNG_NODE, &no_ripng_redistribute_type_cmd);
} }
void
ripng_zebra_stop (void)
{
zclient_stop (zclient);
zclient_free (zclient);
}

View File

@ -353,6 +353,7 @@ extern void ripng_route_map_reset (void);
extern void ripng_terminate (void); extern void ripng_terminate (void);
/* zclient_init() is done by ripng_zebra.c:zebra_init() */ /* zclient_init() is done by ripng_zebra.c:zebra_init() */
extern void zebra_init(struct thread_master *); extern void zebra_init(struct thread_master *);
extern void ripng_zebra_stop (void);
extern void ripng_zclient_reset (void); extern void ripng_zclient_reset (void);
extern void ripng_offset_init (void); extern void ripng_offset_init (void);