*: call if_init()/if_terminate() from vrf_init()/vrf_terminate()

Later, an interface will belong to a specific VRF, and the interface
initialization will be a part of the VRF initialization. So now call
if_init() from vrf_init(), and if_terminate() from vrf_terminate().

Daemons have the according changes:
- if if_init() was called or "iflist" was initialized, now call
  vrf_init() instead;
- if if_terminate() was called or "iflist" was destroyed, now call
  vrf_terminate() instead.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>

Conflicts:
	bgpd/bgp_main.c
	pimd/pim_iface.c
	pimd/pim_iface.h
	pimd/pim_main.c
	pimd/pimd.c
This commit is contained in:
Feng Lu 2015-05-22 11:39:58 +02:00 committed by Vipin Kumar
parent 3968dbf8ef
commit 6a69b354a6
14 changed files with 21 additions and 15 deletions

View File

@ -37,6 +37,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "plist.h"
#include "stream.h"
#include "queue.h"
#include "vrf.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_attr.h"
@ -238,17 +239,14 @@ bgp_exit (int status)
/* reverse bgp_zebra_init/if_init */
if (retain_mode)
if_add_hook (IF_DELETE_HOOK, NULL);
for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp))
for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
{
struct listnode *c_node, *c_nnode;
struct connected *c;
for (ALL_LIST_ELEMENTS (ifp->connected, c_node, c_nnode, c))
bgp_connected_delete (c);
if_delete (ifp);
}
list_free (iflist);
/* reverse bgp_attr_init */
bgp_attr_finish ();
@ -280,6 +278,7 @@ bgp_exit (int status)
/* reverse community_list_init */
community_list_terminate (bgp_clist);
vrf_terminate ();
cmd_terminate ();
vty_terminate ();
if (zclient)
@ -412,6 +411,7 @@ main (int argc, char **argv)
cmd_init (1);
vty_init (bm->master);
memory_init ();
vrf_init ();
/* BGP related initialization. */
bgp_init ();

View File

@ -1738,9 +1738,6 @@ bgp_zebra_init (struct thread_master *master)
zclient->nexthop_update = bgp_read_nexthop_update;
zclient->import_check_update = bgp_read_import_check_update;
/* Interface related init. */
if_init ();
bgp_nexthop_buf = stream_new(BGP_NEXTHOP_BUF_SIZE);
bgp_ifindices_buf = stream_new(BGP_IFINDICES_BUF_SIZE);
}

View File

@ -2739,7 +2739,6 @@ void
isis_circuit_init ()
{
/* Initialize Zebra interface data structure */
if_init ();
if_add_hook (IF_NEW_HOOK, isis_if_new_hook);
if_add_hook (IF_DELETE_HOOK, isis_if_delete_hook);

View File

@ -35,6 +35,7 @@
#include "sigevent.h"
#include "filter.h"
#include "zclient.h"
#include "vrf.h"
#include "isisd/dict.h"
#include "include-netbsd/iso.h"
@ -335,6 +336,7 @@ main (int argc, char **argv, char **envp)
vty_init (master);
memory_init ();
access_list_init();
vrf_init ();
isis_init ();
isis_circuit_init ();
isis_spf_cmds_init ();

View File

@ -22,6 +22,7 @@
#include <zebra.h>
#include "if.h"
#include "vrf.h"
#include "prefix.h"
#include "table.h"
@ -249,6 +250,8 @@ vrf_init (void)
/* Set the default VRF name. */
default_vrf->name = XSTRDUP (MTYPE_VRF_NAME, "Default-IP-Routing-Table");
if_init ();
}
/* Terminate VRF module. */
@ -264,5 +267,7 @@ vrf_terminate (void)
route_table_finish (vrf_table);
vrf_table = NULL;
if_terminate ();
}

View File

@ -36,6 +36,7 @@
#include "privs.h"
#include "sigevent.h"
#include "zclient.h"
#include "vrf.h"
#include "ospf6d.h"
#include "ospf6_top.h"
@ -151,7 +152,7 @@ ospf6_exit (int status)
ospf6_asbr_terminate ();
ospf6_lsa_terminate ();
if_terminate ();
vrf_terminate ();
vty_terminate ();
cmd_terminate ();
@ -322,7 +323,7 @@ main (int argc, char *argv[], char *envp[])
cmd_init (1);
vty_init (master);
memory_init ();
if_init ();
vrf_init ();
access_list_init ();
prefix_list_init ();

View File

@ -1269,7 +1269,6 @@ void
ospf_if_init ()
{
/* Initialize Zebra interface data structure. */
if_init ();
om->iflist = iflist;
if_add_hook (IF_NEW_HOOK, ospf_if_new_hook);
if_add_hook (IF_DELETE_HOOK, ospf_if_delete_hook);

View File

@ -39,6 +39,7 @@
#include "privs.h"
#include "sigevent.h"
#include "zclient.h"
#include "vrf.h"
#include "ospfd/ospfd.h"
#include "ospfd/ospf_interface.h"
@ -300,6 +301,7 @@ main (int argc, char **argv)
debug_init ();
vty_init (master);
memory_init ();
vrf_init ();
access_list_init ();
prefix_list_init ();

View File

@ -2077,7 +2077,6 @@ void
rip_if_init (void)
{
/* Default initial size of interface vector. */
if_init();
if_add_hook (IF_NEW_HOOK, rip_interface_new_hook);
if_add_hook (IF_DELETE_HOOK, rip_interface_delete_hook);

View File

@ -33,6 +33,7 @@
#include "privs.h"
#include "sigevent.h"
#include "zclient.h"
#include "vrf.h"
#include "ripd/ripd.h"
@ -280,6 +281,7 @@ main (int argc, char **argv)
vty_init (master);
memory_init ();
keychain_init ();
vrf_init ();
/* RIP related initialization. */
rip_init ();

View File

@ -35,6 +35,7 @@
#include "table.h"
#include "thread.h"
#include "privs.h"
#include "vrf.h"
#include "ripngd/ripngd.h"
#include "ripngd/ripng_debug.h"
@ -1200,7 +1201,6 @@ void
ripng_if_init ()
{
/* Interface initialize. */
iflist = list_new ();
if_add_hook (IF_NEW_HOOK, ripng_if_new_hook);
if_add_hook (IF_DELETE_HOOK, ripng_if_delete_hook);

View File

@ -34,6 +34,7 @@
#include "if.h"
#include "privs.h"
#include "sigevent.h"
#include "vrf.h"
#include "ripngd/ripngd.h"
@ -276,6 +277,7 @@ main (int argc, char **argv)
cmd_init (1);
vty_init (master);
memory_init ();
vrf_init ();
/* RIPngd inits. */
ripng_init ();

View File

@ -1766,7 +1766,6 @@ void
zebra_if_init (void)
{
/* Initialize interface and new hook. */
if_init ();
if_add_hook (IF_NEW_HOOK, if_zebra_new_hook);
if_add_hook (IF_DELETE_HOOK, if_zebra_delete_hook);

View File

@ -316,7 +316,6 @@ main (int argc, char **argv)
cmd_init (1);
vty_init (zebrad.master);
memory_init ();
if_init();
zebra_debug_init ();
zebra_if_init ();
test_cmd_init ();