summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_zebra.c5
-rw-r--r--isisd/isis_zebra.c4
-rw-r--r--ldpd/lde.c6
-rw-r--r--lib/zclient.c8
-rw-r--r--lib/zclient.h5
-rw-r--r--ospfd/ospf_zebra.c4
-rw-r--r--pathd/path_zebra.c5
-rw-r--r--pimd/pim_zlookup.c5
8 files changed, 15 insertions, 27 deletions
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 57d419fabe..3b25348c4e 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -3430,9 +3430,6 @@ static void bgp_zebra_capabilities(struct zclient_capabilities *cap)
void bgp_zebra_init(struct event_loop *master, unsigned short instance)
{
- struct zclient_options options = zclient_options_default;
-
- options.synchronous = true;
zclient_num_connects = 0;
hook_register_prio(if_real, 0, bgp_ifp_create);
@@ -3450,7 +3447,7 @@ void bgp_zebra_init(struct event_loop *master, unsigned short instance)
zclient->instance = instance;
/* Initialize special zclient for synchronous message exchanges. */
- zclient_sync = zclient_new(master, &options, NULL, 0);
+ zclient_sync = zclient_new(master, &zclient_options_sync, NULL, 0);
zclient_sync->sock = -1;
zclient_sync->redist_default = ZEBRA_ROUTE_BGP;
zclient_sync->instance = instance;
diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c
index 8252c1ac25..18a0c49ceb 100644
--- a/isisd/isis_zebra.c
+++ b/isisd/isis_zebra.c
@@ -1395,9 +1395,7 @@ void isis_zebra_init(struct event_loop *master, int instance)
zclient->zebra_connected = isis_zebra_connected;
/* Initialize special zclient for synchronous message exchanges. */
- struct zclient_options options = zclient_options_default;
- options.synchronous = true;
- zclient_sync = zclient_new(master, &options, NULL, 0);
+ zclient_sync = zclient_new(master, &zclient_options_sync, NULL, 0);
zclient_sync->sock = -1;
zclient_sync->redist_default = ZEBRA_ROUTE_ISIS;
zclient_sync->instance = instance;
diff --git a/ldpd/lde.c b/ldpd/lde.c
index c7e915deb3..ef4aecadad 100644
--- a/ldpd/lde.c
+++ b/ldpd/lde.c
@@ -2135,12 +2135,8 @@ static void zclient_sync_retry(struct event *thread)
*/
static void zclient_sync_init(void)
{
- struct zclient_options options = zclient_options_default;
-
- options.synchronous = true;
-
/* Initialize special zclient for synchronous message exchanges. */
- zclient_sync = zclient_new(master, &options, NULL, 0);
+ zclient_sync = zclient_new(master, &zclient_options_sync, NULL, 0);
zclient_sync->sock = -1;
zclient_sync->redist_default = ZEBRA_ROUTE_LDP;
zclient_sync->session_id = 1; /* Distinguish from main session */
diff --git a/lib/zclient.c b/lib/zclient.c
index 39756933e7..61533aecc6 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -41,10 +41,14 @@ static void zclient_event(enum zclient_event, struct zclient *);
static void zebra_interface_if_set_value(struct stream *s,
struct interface *ifp);
-struct zclient_options zclient_options_default = {
+const struct zclient_options zclient_options_default = {
.synchronous = false,
};
+const struct zclient_options zclient_options_sync = {
+ .synchronous = true,
+};
+
struct sockaddr_storage zclient_addr;
socklen_t zclient_addr_len;
@@ -53,7 +57,7 @@ static int zclient_debug;
/* Allocate zclient structure. */
struct zclient *zclient_new(struct event_loop *master,
- struct zclient_options *opt,
+ const struct zclient_options *opt,
zclient_handler *const *handlers, size_t n_handlers)
{
struct zclient *zclient;
diff --git a/lib/zclient.h b/lib/zclient.h
index 8332f2a057..c8dff18bb9 100644
--- a/lib/zclient.h
+++ b/lib/zclient.h
@@ -834,7 +834,8 @@ struct zclient_options {
bool synchronous;
};
-extern struct zclient_options zclient_options_default;
+extern const struct zclient_options zclient_options_default;
+extern const struct zclient_options zclient_options_sync;
/* link layer representation for GRE like interfaces
* ip_in is the underlay IP, ip_out is the tunnel dest
@@ -881,7 +882,7 @@ int zclient_neigh_ip_encode(struct stream *s, uint16_t cmd, union sockunion *in,
extern uint32_t zclient_get_nhg_start(uint32_t proto);
extern struct zclient *zclient_new(struct event_loop *m,
- struct zclient_options *opt,
+ const struct zclient_options *opt,
zclient_handler *const *handlers,
size_t n_handlers);
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index 19d3c9a083..bb6cc3a89c 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -2189,9 +2189,7 @@ void ospf_zebra_init(struct event_loop *master, unsigned short instance)
zclient->nexthop_update = ospf_zebra_import_check_update;
/* Initialize special zclient for synchronous message exchanges. */
- struct zclient_options options = zclient_options_default;
- options.synchronous = true;
- zclient_sync = zclient_new(master, &options, NULL, 0);
+ zclient_sync = zclient_new(master, &zclient_options_sync, NULL, 0);
zclient_sync->sock = -1;
zclient_sync->redist_default = ZEBRA_ROUTE_OSPF;
zclient_sync->instance = instance;
diff --git a/pathd/path_zebra.c b/pathd/path_zebra.c
index 826443f979..645fa50856 100644
--- a/pathd/path_zebra.c
+++ b/pathd/path_zebra.c
@@ -320,9 +320,6 @@ static zclient_handler *const path_handlers[] = {
*/
void path_zebra_init(struct event_loop *master)
{
- struct zclient_options options = zclient_options_default;
- options.synchronous = true;
-
/* Initialize asynchronous zclient. */
zclient = zclient_new(master, &zclient_options_default, path_handlers,
array_size(path_handlers));
@@ -330,7 +327,7 @@ void path_zebra_init(struct event_loop *master)
zclient->zebra_connected = path_zebra_connected;
/* Initialize special zclient for synchronous message exchanges. */
- zclient_sync = zclient_new(master, &options, NULL, 0);
+ zclient_sync = zclient_new(master, &zclient_options_sync, NULL, 0);
zclient_sync->sock = -1;
zclient_sync->redist_default = ZEBRA_ROUTE_SRTE;
zclient_sync->instance = 1;
diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c
index 6a026f9947..c19119fa47 100644
--- a/pimd/pim_zlookup.c
+++ b/pimd/pim_zlookup.c
@@ -122,10 +122,7 @@ void zclient_lookup_free(void)
void zclient_lookup_new(void)
{
- struct zclient_options options = zclient_options_default;
- options.synchronous = true;
-
- zlookup = zclient_new(router->master, &options, NULL, 0);
+ zlookup = zclient_new(router->master, &zclient_options_sync, NULL, 0);
if (!zlookup) {
flog_err(EC_LIB_ZAPI_SOCKET, "%s: zclient_new() failure",
__func__);