diff options
Diffstat (limited to 'zebra/zebra_pw.c')
| -rw-r--r-- | zebra/zebra_pw.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/zebra/zebra_pw.c b/zebra/zebra_pw.c index 12dcac1de5..deed3b6ad3 100644 --- a/zebra/zebra_pw.c +++ b/zebra/zebra_pw.c @@ -377,15 +377,18 @@ static int zebra_pw_client_close(struct zserv *client) return 0; } -void zebra_pw_init(struct zebra_vrf *zvrf) +static void zebra_pw_init(void) +{ + hook_register(zserv_client_close, zebra_pw_client_close); +} + +void zebra_pw_init_vrf(struct zebra_vrf *zvrf) { RB_INIT(zebra_pw_head, &zvrf->pseudowires); RB_INIT(zebra_static_pw_head, &zvrf->static_pseudowires); - - hook_register(zserv_client_close, zebra_pw_client_close); } -void zebra_pw_exit(struct zebra_vrf *zvrf) +void zebra_pw_exit_vrf(struct zebra_vrf *zvrf) { struct zebra_pw *pw; @@ -396,6 +399,11 @@ void zebra_pw_exit(struct zebra_vrf *zvrf) } } +void zebra_pw_terminate(void) +{ + hook_unregister(zserv_client_close, zebra_pw_client_close); +} + DEFUN_NOSH (pseudowire_if, pseudowire_if_cmd, "pseudowire IFNAME", @@ -408,8 +416,6 @@ DEFUN_NOSH (pseudowire_if, int idx = 0; zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); - if (!zvrf) - return CMD_WARNING; argv_find(argv, argc, "IFNAME", &idx); ifname = argv[idx]->arg; @@ -440,8 +446,6 @@ DEFUN (no_pseudowire_if, int idx = 0; zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); - if (!zvrf) - return CMD_WARNING; argv_find(argv, argc, "IFNAME", &idx); ifname = argv[idx]->arg; @@ -564,8 +568,6 @@ DEFUN (show_pseudowires, struct zebra_pw *pw; zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); - if (!zvrf) - return 0; vty_out(vty, "%-16s %-24s %-12s %-8s %-10s\n", "Interface", "Neighbor", "Labels", "Protocol", "Status"); @@ -603,8 +605,6 @@ static void vty_show_mpls_pseudowire_detail(struct vty *vty) struct nexthop_group *nhg; zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); - if (!zvrf) - return; RB_FOREACH (pw, zebra_pw_head, &zvrf->pseudowires) { char buf_nbr[INET6_ADDRSTRLEN]; @@ -759,8 +759,6 @@ static void vty_show_mpls_pseudowire_detail_json(struct vty *vty) struct zebra_pw *pw; zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); - if (!zvrf) - return; json = json_object_new_object(); json_pws = json_object_new_array(); @@ -795,8 +793,6 @@ static int zebra_pw_config(struct vty *vty) struct zebra_pw *pw; zvrf = zebra_vrf_lookup_by_id(VRF_DEFAULT); - if (!zvrf) - return 0; RB_FOREACH (pw, zebra_static_pw_head, &zvrf->static_pseudowires) { vty_out(vty, "pseudowire %s\n", pw->ifname); @@ -849,4 +845,6 @@ void zebra_pw_vty_init(void) install_element(VIEW_NODE, &show_pseudowires_cmd); install_element(VIEW_NODE, &show_pseudowires_detail_cmd); + + zebra_pw_init(); } |
