pimd: clear zclient-update: Reset zclient update connection to zebra daemon
diff --git a/pimd/COMMANDS b/pimd/COMMANDS
index 425ac82..2dedea0 100644
--- a/pimd/COMMANDS
+++ b/pimd/COMMANDS
@@ -60,6 +60,7 @@
        clear ip mroute                  Reset multicast routes
        clear ip pim interfaces		Reset PIM interfaces
        clear ip pim oil			Rescan PIM OIL (output interface list)
+       clear zclient-update		Reset zclient update connection to zebra daemon
        debug igmp			IGMP protocol activity
        debug mroute			PIM interaction with kernel MFC cache
        debug pim			PIM protocol activity
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 9363e3c..a49264a 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -27,6 +27,7 @@
 #include "command.h"
 #include "if.h"
 #include "prefix.h"
+#include "zclient.h"
 
 #include "pimd.h"
 #include "pim_cmd.h"
@@ -1562,6 +1563,17 @@
   return CMD_SUCCESS;
 }
 
+DEFUN (clear_zclient_update,
+       clear_zclient_update_cmd,
+       "clear zclient-update",
+       CLEAR_STR
+       "Reset zclient update connection to zebra daemon\n")
+{
+  zclient_reset(qpim_zclient_update);
+
+  return CMD_SUCCESS;
+}
+
 DEFUN (clear_ip_interfaces,
        clear_ip_interfaces_cmd,
        "clear ip interfaces",
@@ -4312,6 +4324,7 @@
   install_element (ENABLE_NODE, &clear_ip_mroute_cmd);
   install_element (ENABLE_NODE, &clear_ip_pim_interfaces_cmd);
   install_element (ENABLE_NODE, &clear_ip_pim_oil_cmd);
+  install_element (ENABLE_NODE, &clear_zclient_update_cmd);
 
   install_element (ENABLE_NODE, &show_ip_igmp_interface_cmd);
   install_element (ENABLE_NODE, &show_ip_igmp_join_cmd);
diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c
index e080c04..44046db 100644
--- a/pimd/pim_zebra.c
+++ b/pimd/pim_zebra.c
@@ -644,7 +644,6 @@
 
 void pim_zebra_init()
 {
-  struct zclient *zclient;
   int i;
 
 #ifdef HAVE_TCP_ZEBRA
@@ -654,35 +653,35 @@
 #endif
 
   /* Socket for receiving updates from Zebra daemon */
-  zclient = zclient_new();
+  qpim_zclient_update = zclient_new();
 
-  zclient->router_id_update         = pim_router_id_update;
-  zclient->router_id_update         = pim_router_id_update_zebra;
-  zclient->interface_add            = pim_zebra_if_add;
-  zclient->interface_delete         = pim_zebra_if_del;
-  zclient->interface_up             = pim_zebra_if_state_up;
-  zclient->interface_down           = pim_zebra_if_state_down;
-  zclient->interface_address_add    = pim_zebra_if_address_add;
-  zclient->interface_address_delete = pim_zebra_if_address_del;
-  zclient->ipv4_route_add           = redist_read_ipv4_route;
-  zclient->ipv4_route_delete        = redist_read_ipv4_route;
+  qpim_zclient_update->zclient_broken           = zclient_broken;
+  qpim_zclient_update->router_id_update         = pim_router_id_update_zebra;
+  qpim_zclient_update->interface_add            = pim_zebra_if_add;
+  qpim_zclient_update->interface_delete         = pim_zebra_if_del;
+  qpim_zclient_update->interface_up             = pim_zebra_if_state_up;
+  qpim_zclient_update->interface_down           = pim_zebra_if_state_down;
+  qpim_zclient_update->interface_address_add    = pim_zebra_if_address_add;
+  qpim_zclient_update->interface_address_delete = pim_zebra_if_address_del;
+  qpim_zclient_update->ipv4_route_add           = redist_read_ipv4_route;
+  qpim_zclient_update->ipv4_route_delete        = redist_read_ipv4_route;
 
-  zclient_init(zclient, ZEBRA_ROUTE_PIM);
+  zclient_init(qpim_zclient_update, ZEBRA_ROUTE_PIM);
   zlog_info("zclient_init cleared redistribution request");
 
-  zassert(zclient->redist_default == ZEBRA_ROUTE_PIM);
+  zassert(qpim_zclient_update->redist_default == ZEBRA_ROUTE_PIM);
 
   /* Request all redistribution */
   for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
-    if (i == zclient->redist_default)
+    if (i == qpim_zclient_update->redist_default)
       continue;
-    zclient->redist[i] = 1;
+    qpim_zclient_update->redist[i] = 1;
     zlog_info("%s: requesting redistribution for %s (%i)", 
 	      __PRETTY_FUNCTION__, zebra_route_string(i), i);
   }
 
   /* Request default information */
-  zclient->default_information = 1;
+  qpim_zclient_update->default_information = 1;
   zlog_info("%s: requesting default information redistribution",
 	    __PRETTY_FUNCTION__);
 
diff --git a/pimd/pimd.c b/pimd/pimd.c
index 49ddc21..855defc 100644
--- a/pimd/pimd.c
+++ b/pimd/pimd.c
@@ -51,6 +51,7 @@
 struct list              *qpim_channel_oil_list = 0;
 int                       qpim_t_periodic = PIM_DEFAULT_T_PERIODIC; /* Period between Join/Prune Messages */
 struct list              *qpim_upstream_list = 0;
+struct zclient           *qpim_zclient_update = 0;
 struct zclient           *qpim_zclient_lookup = 0;
 struct pim_assert_metric  qpim_infinite_assert_metric;
 long                      qpim_rpf_cache_refresh_delay_msec = 10000;
diff --git a/pimd/pimd.h b/pimd/pimd.h
index 68b1199..b0a1b64 100644
--- a/pimd/pimd.h
+++ b/pimd/pimd.h
@@ -80,6 +80,7 @@
 struct in_addr            qpim_all_pim_routers_addr;
 int                       qpim_t_periodic; /* Period between Join/Prune Messages */
 struct list              *qpim_upstream_list; /* list of struct pim_upstream */
+struct zclient           *qpim_zclient_update;
 struct zclient           *qpim_zclient_lookup;
 struct pim_assert_metric  qpim_infinite_assert_metric;
 long                      qpim_rpf_cache_refresh_delay_msec;