|
version 1.1.1.2, 2012/10/09 09:22:29
|
version 1.1.1.4, 2016/11/02 10:09:10
|
|
Line 32
|
Line 32
|
| #include "plist.h" |
#include "plist.h" |
| #include "privs.h" |
#include "privs.h" |
| #include "sigevent.h" |
#include "sigevent.h" |
| |
#include "vrf.h" |
| |
|
| #include "zebra/rib.h" |
#include "zebra/rib.h" |
| #include "zebra/zserv.h" |
#include "zebra/zserv.h" |
|
Line 39
|
Line 40
|
| #include "zebra/router-id.h" |
#include "zebra/router-id.h" |
| #include "zebra/irdp.h" |
#include "zebra/irdp.h" |
| #include "zebra/rtadv.h" |
#include "zebra/rtadv.h" |
| |
#include "zebra/zebra_fpm.h" |
| |
|
| /* Zebra instance */ |
/* Zebra instance */ |
| struct zebra_t zebrad = |
struct zebra_t zebrad = |
|
Line 104 struct zebra_privs_t zserv_privs =
|
Line 106 struct zebra_privs_t zserv_privs =
|
| .vty_group = VTY_GROUP, |
.vty_group = VTY_GROUP, |
| #endif |
#endif |
| .caps_p = _caps_p, |
.caps_p = _caps_p, |
| .cap_num_p = sizeof(_caps_p)/sizeof(_caps_p[0]), | .cap_num_p = array_size(_caps_p), |
| .cap_num_i = 0 |
.cap_num_i = 0 |
| }; |
}; |
| |
|
|
Line 150 usage (char *progname, int status)
|
Line 152 usage (char *progname, int status)
|
| |
|
| exit (status); |
exit (status); |
| } |
} |
| |
| /* SIGHUP handler. */ |
/* SIGHUP handler. */ |
| static void |
static void |
| sighup (void) |
sighup (void) |
|
Line 202 struct quagga_signal_t zebra_signals[] =
|
Line 204 struct quagga_signal_t zebra_signals[] =
|
| .handler = &sigint, |
.handler = &sigint, |
| }, |
}, |
| }; |
}; |
| |
| | /* Callback upon creating a new VRF. */ |
| | static int |
| | zebra_vrf_new (vrf_id_t vrf_id, void **info) |
| | { |
| | struct zebra_vrf *zvrf = *info; |
| | |
| | if (! zvrf) |
| | { |
| | zvrf = zebra_vrf_alloc (vrf_id); |
| | *info = (void *)zvrf; |
| | router_id_init (zvrf); |
| | } |
| | |
| | return 0; |
| | } |
| | |
| | /* Callback upon enabling a VRF. */ |
| | static int |
| | zebra_vrf_enable (vrf_id_t vrf_id, void **info) |
| | { |
| | struct zebra_vrf *zvrf = (struct zebra_vrf *) (*info); |
| | |
| | assert (zvrf); |
| | |
| | #if defined (HAVE_RTADV) |
| | rtadv_init (zvrf); |
| | #endif |
| | kernel_init (zvrf); |
| | interface_list (zvrf); |
| | route_read (zvrf); |
| | |
| | return 0; |
| | } |
| | |
| | /* Callback upon disabling a VRF. */ |
| | static int |
| | zebra_vrf_disable (vrf_id_t vrf_id, void **info) |
| | { |
| | struct zebra_vrf *zvrf = (struct zebra_vrf *) (*info); |
| | struct listnode *list_node; |
| | struct interface *ifp; |
| | |
| | assert (zvrf); |
| | |
| | rib_close_table (zvrf->table[AFI_IP][SAFI_UNICAST]); |
| | rib_close_table (zvrf->table[AFI_IP6][SAFI_UNICAST]); |
| | |
| | for (ALL_LIST_ELEMENTS_RO (vrf_iflist (vrf_id), list_node, ifp)) |
| | { |
| | int operative = if_is_operative (ifp); |
| | UNSET_FLAG (ifp->flags, IFF_UP); |
| | if (operative) |
| | if_down (ifp); |
| | } |
| | |
| | #if defined (HAVE_RTADV) |
| | rtadv_terminate (zvrf); |
| | #endif |
| | kernel_terminate (zvrf); |
| | |
| | list_delete_all_node (zvrf->rid_all_sorted_list); |
| | list_delete_all_node (zvrf->rid_lo_sorted_list); |
| | |
| | return 0; |
| | } |
| | |
| | /* Zebra VRF initialization. */ |
| | static void |
| | zebra_vrf_init (void) |
| | { |
| | vrf_add_hook (VRF_NEW_HOOK, zebra_vrf_new); |
| | vrf_add_hook (VRF_ENABLE_HOOK, zebra_vrf_enable); |
| | vrf_add_hook (VRF_DISABLE_HOOK, zebra_vrf_disable); |
| | vrf_init (); |
| | } |
| | |
| /* Main startup routine. */ |
/* Main startup routine. */ |
| int |
int |
| main (int argc, char **argv) |
main (int argc, char **argv) |
|
Line 313 main (int argc, char **argv)
|
Line 391 main (int argc, char **argv)
|
| zprivs_init (&zserv_privs); |
zprivs_init (&zserv_privs); |
| |
|
| /* Vty related initialize. */ |
/* Vty related initialize. */ |
| signal_init (zebrad.master, Q_SIGC(zebra_signals), zebra_signals); | signal_init (zebrad.master, array_size(zebra_signals), zebra_signals); |
| cmd_init (1); |
cmd_init (1); |
| vty_init (zebrad.master); |
vty_init (zebrad.master); |
| memory_init (); |
memory_init (); |
|
Line 323 main (int argc, char **argv)
|
Line 401 main (int argc, char **argv)
|
| rib_init (); |
rib_init (); |
| zebra_if_init (); |
zebra_if_init (); |
| zebra_debug_init (); |
zebra_debug_init (); |
| router_id_init(); | router_id_cmd_init (); |
| zebra_vty_init (); |
zebra_vty_init (); |
| access_list_init (); |
access_list_init (); |
| prefix_list_init (); |
prefix_list_init (); |
| rtadv_init (); | #if defined (HAVE_RTADV) |
| | rtadv_cmd_init (); |
| | #endif |
| #ifdef HAVE_IRDP |
#ifdef HAVE_IRDP |
| irdp_init(); |
irdp_init(); |
| #endif |
#endif |
|
Line 335 main (int argc, char **argv)
|
Line 415 main (int argc, char **argv)
|
| /* For debug purpose. */ |
/* For debug purpose. */ |
| /* SET_FLAG (zebra_debug_event, ZEBRA_DEBUG_EVENT); */ |
/* SET_FLAG (zebra_debug_event, ZEBRA_DEBUG_EVENT); */ |
| |
|
| /* Make kernel routing socket. */ | /* Initialize VRF module, and make kernel routing socket. */ |
| kernel_init (); | zebra_vrf_init (); |
| interface_list (); | |
| route_read (); | |
| |
|
| /* Sort VTY commands. */ |
|
| sort_node (); |
|
| |
|
| #ifdef HAVE_SNMP |
#ifdef HAVE_SNMP |
| zebra_snmp_init (); |
zebra_snmp_init (); |
| #endif /* HAVE_SNMP */ |
#endif /* HAVE_SNMP */ |
| |
|
| |
#ifdef HAVE_FPM |
| |
zfpm_init (zebrad.master, 1, 0); |
| |
#else |
| |
zfpm_init (zebrad.master, 0, 0); |
| |
#endif |
| |
|
| /* Process the configuration file. Among other configuration |
/* Process the configuration file. Among other configuration |
| * directives we can meet those installing static routes. Such |
* directives we can meet those installing static routes. Such |