diff options
| -rw-r--r-- | pbrd/pbr_zebra.c | 36 | ||||
| -rw-r--r-- | staticd/static_zebra.c | 45 | ||||
| -rw-r--r-- | vrrpd/vrrp_zebra.c | 14 | 
3 files changed, 48 insertions, 47 deletions
diff --git a/pbrd/pbr_zebra.c b/pbrd/pbr_zebra.c index 277271c6b6..dc8cbc56bf 100644 --- a/pbrd/pbr_zebra.c +++ b/pbrd/pbr_zebra.c @@ -35,7 +35,7 @@  DEFINE_MTYPE_STATIC(PBRD, PBR_INTERFACE, "PBR Interface");  /* Zebra structure to hold current status. */ -struct zclient *zclient; +struct zclient *pbr_zclient;  struct pbr_interface *pbr_if_new(struct interface *ifp)  { @@ -272,7 +272,7 @@ static void route_add_helper(struct zapi_route *api, struct nexthop_group nhg,  	}  	api->nexthop_num = i; -	zclient_route_send(ZEBRA_ROUTE_ADD, zclient, api); +	zclient_route_send(ZEBRA_ROUTE_ADD, pbr_zclient, api);  }  /* @@ -342,17 +342,17 @@ void route_delete(struct pbr_nexthop_group_cache *pnhgc, afi_t afi)  	switch (afi) {  	case AFI_IP:  		api.prefix.family = AF_INET; -		zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); +		zclient_route_send(ZEBRA_ROUTE_DELETE, pbr_zclient, &api);  		break;  	case AFI_IP6:  		api.prefix.family = AF_INET6; -		zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); +		zclient_route_send(ZEBRA_ROUTE_DELETE, pbr_zclient, &api);  		break;  	case AFI_MAX:  		api.prefix.family = AF_INET; -		zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); +		zclient_route_send(ZEBRA_ROUTE_DELETE, pbr_zclient, &api);  		api.prefix.family = AF_INET6; -		zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); +		zclient_route_send(ZEBRA_ROUTE_DELETE, pbr_zclient, &api);  		break;  	case AFI_L2VPN:  		DEBUGD(&pbr_dbg_zebra, @@ -403,22 +403,22 @@ static zclient_handler *const pbr_handlers[] = {  void pbr_zebra_init(void)  { -	zclient = zclient_new(master, &zclient_options_default, pbr_handlers, -			      array_size(pbr_handlers)); +	pbr_zclient = zclient_new(master, &zclient_options_default, pbr_handlers, +				  array_size(pbr_handlers)); -	zclient_init(zclient, ZEBRA_ROUTE_PBR, 0, &pbr_privs); -	zclient->zebra_connected = zebra_connected; -	zclient->nexthop_update = pbr_zebra_nexthop_update; +	zclient_init(pbr_zclient, ZEBRA_ROUTE_PBR, 0, &pbr_privs); +	pbr_zclient->zebra_connected = zebra_connected; +	pbr_zclient->nexthop_update = pbr_zebra_nexthop_update;  }  void pbr_zebra_destroy(void)  { -	if (zclient == NULL) +	if (pbr_zclient == NULL)  		return; -	zclient_stop(zclient); -	zclient_free(zclient); -	zclient = NULL; +	zclient_stop(pbr_zclient); +	zclient_free(pbr_zclient); +	pbr_zclient = NULL;  }  void pbr_send_rnh(struct nexthop *nhop, bool reg) @@ -454,7 +454,7 @@ void pbr_send_rnh(struct nexthop *nhop, bool reg)  		break;  	} -	if (zclient_send_rnh(zclient, command, &p, SAFI_UNICAST, false, false, +	if (zclient_send_rnh(pbr_zclient, command, &p, SAFI_UNICAST, false, false,  			     nhop->vrf_id)  	    == ZCLIENT_SEND_FAILURE) {  		zlog_warn("%s: Failure to send nexthop to zebra", __func__); @@ -608,7 +608,7 @@ bool pbr_send_pbr_map(struct pbr_map_sequence *pbrms,  	if (!install && !is_installed)  		return false; -	s = zclient->obuf; +	s = pbr_zclient->obuf;  	stream_reset(s);  	zclient_create_header(s, @@ -621,7 +621,7 @@ bool pbr_send_pbr_map(struct pbr_map_sequence *pbrms,  	if (pbr_encode_pbr_map_sequence(s, pbrms, pmi->ifp)) {  		stream_putw_at(s, 0, stream_get_endp(s)); -		zclient_send_message(zclient); +		zclient_send_message(pbr_zclient);  	} else {  		DEBUGD(&pbr_dbg_zebra, "%s: %s seq %u encode failed, skipped",  		       __func__, pbrm->name, pbrms->seqno); diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c index e3b646a392..714f4b89ea 100644 --- a/staticd/static_zebra.c +++ b/staticd/static_zebra.c @@ -75,7 +75,7 @@ DECLARE_HASH(static_nht_hash, struct static_nht_data, itm, static_nht_data_cmp,  static struct static_nht_hash_head static_nht_hash[1];  /* Zebra structure to hold current status. */ -struct zclient *zclient; +struct zclient *static_zclient;  uint32_t zebra_ecmp_count = MULTIPATH_NUM;  /* Interface addition message from zebra. */ @@ -211,7 +211,7 @@ static void static_zebra_nexthop_update(struct vrf *vrf, struct prefix *matched,  	struct static_nht_data *nhtd, lookup;  	afi_t afi = AFI_IP; -	if (zclient->bfd_integration) +	if (static_zclient->bfd_integration)  		bfd_nht_update(matched, nhr);  	if (matched->family == AF_INET6) @@ -395,7 +395,7 @@ void static_zebra_nht_register(struct static_nexthop *nh, bool reg)  		       "Unregistering nexthop(%pFX) for %pRN", &lookup.nh, rn);  	} -	if (zclient_send_rnh(zclient, cmd, &lookup.nh, si->safi, false, false, +	if (zclient_send_rnh(static_zclient, cmd, &lookup.nh, si->safi, false, false,  			     nh->nh_vrf_id) == ZCLIENT_SEND_FAILURE)  		zlog_warn("%s: Failure to send nexthop %pFX for %pRN to zebra",  			  __func__, &lookup.nh, rn); @@ -549,7 +549,7 @@ extern void static_zebra_route_add(struct static_path *pn, bool install)  	zclient_route_send(install ?  			   ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE, -			   zclient, &api); +			   static_zclient, &api);  }  /** @@ -594,7 +594,7 @@ static void static_zebra_send_localsid(int cmd, const struct in6_addr *sid, uint  	memcpy(&api.prefix, &p, sizeof(p));  	if (cmd == ZEBRA_ROUTE_DELETE) -		return (void)zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); +		return (void)zclient_route_send(ZEBRA_ROUTE_DELETE, static_zclient, &api);  	SET_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION);  	SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP); @@ -611,7 +611,7 @@ static void static_zebra_send_localsid(int cmd, const struct in6_addr *sid, uint  	api.nexthop_num = 1; -	zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api); +	zclient_route_send(ZEBRA_ROUTE_ADD, static_zclient, &api);  }  /** @@ -1004,7 +1004,8 @@ extern void static_zebra_request_srv6_sid(struct static_srv6_sid *sid)  	}  	/* Request SRv6 SID from SID Manager */ -	ret = srv6_manager_get_sid(zclient, &ctx, &sid->addr.prefix, sid->locator->name, NULL); +	ret = srv6_manager_get_sid(static_zclient, &ctx, &sid->addr.prefix, sid->locator->name, +				   NULL);  	if (ret < 0)  		zlog_warn("%s: error getting SRv6 SID!", __func__);  } @@ -1091,7 +1092,7 @@ extern void static_zebra_release_srv6_sid(struct static_srv6_sid *sid)  	}  	/* remove the SRv6 SID from the zebra RIB */ -	ret = srv6_manager_release_sid(zclient, &ctx); +	ret = srv6_manager_release_sid(static_zclient, &ctx);  	if (ret == ZCLIENT_SEND_FAILURE)  		flog_err(EC_LIB_ZAPI_SOCKET, "zclient_send_get_srv6_sid() delete failed: %s",  			 safe_strerror(errno)); @@ -1112,7 +1113,7 @@ int static_zebra_srv6_manager_get_locator(const char *name)  	 * Send the Get Locator request to the SRv6 Manager and return the  	 * result  	 */ -	return srv6_manager_get_locator(zclient, name); +	return srv6_manager_get_locator(static_zclient, name);  }  static void request_srv6_sids(struct static_srv6_locator *locator) @@ -1367,16 +1368,16 @@ void static_zebra_init(void)  	hook_register_prio(if_down, 0, static_ifp_down);  	hook_register_prio(if_unreal, 0, static_ifp_destroy); -	zclient = zclient_new(master, &zclient_options_default, static_handlers, -			      array_size(static_handlers)); +	static_zclient = zclient_new(master, &zclient_options_default, static_handlers, +				     array_size(static_handlers)); -	zclient_init(zclient, ZEBRA_ROUTE_STATIC, 0, &static_privs); -	zclient->zebra_capabilities = static_zebra_capabilities; -	zclient->zebra_connected = zebra_connected; -	zclient->nexthop_update = static_zebra_nexthop_update; +	zclient_init(static_zclient, ZEBRA_ROUTE_STATIC, 0, &static_privs); +	static_zclient->zebra_capabilities = static_zebra_capabilities; +	static_zclient->zebra_connected = zebra_connected; +	static_zclient->nexthop_update = static_zebra_nexthop_update;  	static_nht_hash_init(static_nht_hash); -	static_bfd_initialize(zclient, master); +	static_bfd_initialize(static_zclient, master);  }  /* static_zebra_stop used by tests/lib/test_grpc.cpp */ @@ -1385,23 +1386,23 @@ void static_zebra_stop(void)  	static_nht_hash_clear();  	static_nht_hash_fini(static_nht_hash); -	if (!zclient) +	if (!static_zclient)  		return; -	zclient_stop(zclient); -	zclient_free(zclient); -	zclient = NULL; +	zclient_stop(static_zclient); +	zclient_free(static_zclient); +	static_zclient = NULL;  }  void static_zebra_vrf_register(struct vrf *vrf)  {  	if (vrf->vrf_id == VRF_DEFAULT)  		return; -	zclient_send_reg_requests(zclient, vrf->vrf_id); +	zclient_send_reg_requests(static_zclient, vrf->vrf_id);  }  void static_zebra_vrf_unregister(struct vrf *vrf)  {  	if (vrf->vrf_id == VRF_DEFAULT)  		return; -	zclient_send_dereg_requests(zclient, vrf->vrf_id); +	zclient_send_dereg_requests(static_zclient, vrf->vrf_id);  } diff --git a/vrrpd/vrrp_zebra.c b/vrrpd/vrrp_zebra.c index 009432b217..6b4b3104ea 100644 --- a/vrrpd/vrrp_zebra.c +++ b/vrrpd/vrrp_zebra.c @@ -19,7 +19,7 @@  #define VRRP_LOGPFX "[ZEBRA] " -static struct zclient *zclient; +static struct zclient *vrrp_zclient;  static void vrrp_zebra_debug_if_state(struct interface *ifp, const char *func)  { @@ -161,7 +161,7 @@ void vrrp_zebra_radv_set(struct vrrp_router *r, bool enable)  	       "Requesting Zebra to turn router advertisements %s for %s",  	       r->vr->vrid, enable ? "on" : "off", r->mvl_ifp->name); -	zclient_send_interface_radv_req(zclient, r->mvl_ifp->vrf->vrf_id, +	zclient_send_interface_radv_req(vrrp_zclient, r->mvl_ifp->vrf->vrf_id,  					r->mvl_ifp, enable, VRRP_RADV_INT);  } @@ -171,7 +171,7 @@ void vrrp_zclient_send_interface_protodown(struct interface *ifp, bool down)  	       VRRP_LOGPFX "Requesting Zebra to set %s protodown %s", ifp->name,  	       down ? "on" : "off"); -	zclient_send_interface_protodown(zclient, ifp->vrf->vrf_id, ifp, down); +	zclient_send_interface_protodown(vrrp_zclient, ifp->vrf->vrf_id, ifp, down);  }  static zclient_handler *const vrrp_handlers[] = { @@ -188,12 +188,12 @@ void vrrp_zebra_init(void)  	hook_register_prio(if_unreal, 0, vrrp_ifp_destroy);  	/* Socket for receiving updates from Zebra daemon */ -	zclient = zclient_new(master, &zclient_options_default, vrrp_handlers, -			      array_size(vrrp_handlers)); +	vrrp_zclient = zclient_new(master, &zclient_options_default, vrrp_handlers, +				   array_size(vrrp_handlers)); -	zclient->zebra_connected = vrrp_zebra_connected; +	vrrp_zclient->zebra_connected = vrrp_zebra_connected; -	zclient_init(zclient, ZEBRA_ROUTE_VRRP, 0, &vrrp_privs); +	zclient_init(vrrp_zclient, ZEBRA_ROUTE_VRRP, 0, &vrrp_privs);  	zlog_notice("%s: zclient socket initialized", __func__);  }  | 
