if (lp_fifo_count(&lp->requests) > lp->pending_count) {
if (!zclient || zclient->sock < 0)
return;
- if (!zclient_send_get_label_chunk(zclient, 0, LP_CHUNK_SIZE,
- MPLS_LABEL_BASE_ANY))
+ if (zclient_send_get_label_chunk(zclient, 0, LP_CHUNK_SIZE,
+ MPLS_LABEL_BASE_ANY)
+ == ZCLIENT_SEND_FAILURE)
lp->pending_count += LP_CHUNK_SIZE;
}
}
ret = zclient_send_rnh(zclient, command, &bnc->prefix, exact_match,
bnc->bgp->vrf_id);
/* TBD: handle the failure */
- if (ret < 0)
+ if (ret == ZCLIENT_SEND_FAILURE)
flog_warn(EC_BGP_ZEBRA_SEND,
"sendmsg_nexthop: zclient_send_message() failed");
}
if (zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, zclient, &api)
- < 0) {
+ == ZCLIENT_SEND_FAILURE) {
zlog_err("error sending capability");
ret = BGP_GR_FAILURE;
} else {
api.cap = type;
if (zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, zclient, &api)
- < 0) {
+ == ZCLIENT_SEND_FAILURE) {
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("error sending capability");
return BGP_GR_FAILURE;
api.stale_removal_time = bgp->rib_stale_time;
api.vrf_id = bgp->vrf_id;
if (zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, zclient, &api)
- < 0) {
+ == ZCLIENT_SEND_FAILURE) {
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("error sending capability");
return BGP_GR_FAILURE;
set_nonblocking(zclient_sync->sock);
/* Send hello to notify zebra this is a synchronous client */
- if (zclient_send_hello(zclient_sync) < 0) {
+ if (zclient_send_hello(zclient_sync) == ZCLIENT_SEND_FAILURE) {
zlog_warn("%s: failed sending hello for synchronous zclient!",
__func__);
close(zclient_sync->sock);
sock_set_nonblock(zclient_sync->sock);
/* Send hello to notify zebra this is a synchronous client */
- if (zclient_send_hello(zclient_sync) < 0) {
+ if (zclient_send_hello(zclient_sync) == ZCLIENT_SEND_FAILURE) {
log_warnx("Error sending hello for synchronous zclient!");
goto retry;
}
int
ldp_sync_zebra_send_state_update(struct ldp_igp_sync_if_state *state)
{
- return zclient_send_opaque(zclient, LDP_IGP_SYNC_IF_STATE_UPDATE,
- (const uint8_t *) state, sizeof(*state));
+ if (zclient_send_opaque(zclient, LDP_IGP_SYNC_IF_STATE_UPDATE,
+ (const uint8_t *)state, sizeof(*state))
+ == ZCLIENT_SEND_FAILURE)
+ return -1;
+ else
+ return 0;
}
static int
struct ldp_igp_sync_announce announce;
announce.proto = ZEBRA_ROUTE_LDP;
- return zclient_send_opaque(zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE,
- (const uint8_t *) &announce, sizeof(announce));
+ if (zclient_send_opaque(zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE,
+ (const uint8_t *)&announce, sizeof(announce))
+ == ZCLIENT_SEND_FAILURE)
+ return -1;
+ else
+ return 0;
}
static int
znh->label_num = 1;
znh->labels[0] = kr->remote_label;
- return zebra_send_mpls_labels(zclient, cmd, &zl);
+ if (zebra_send_mpls_labels(zclient, cmd, &zl) == ZCLIENT_SEND_FAILURE)
+ return -1;
+
+ return 0;
}
int
debug_zebra_out("pseudowire %s nexthop %s (add)",
zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop));
- return (zebra_send_pw(zclient, ZEBRA_PW_ADD, zpw));
+ return zebra_send_pw(zclient, ZEBRA_PW_ADD, zpw)
+ == ZCLIENT_SEND_FAILURE;
}
int
debug_zebra_out("pseudowire %s nexthop %s (del)",
zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop));
- return (zebra_send_pw(zclient, ZEBRA_PW_DELETE, zpw));
+ return zebra_send_pw(zclient, ZEBRA_PW_DELETE, zpw)
+ == ZCLIENT_SEND_FAILURE;
}
int
zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop),
zpw->local_label, zpw->remote_label);
- return (zebra_send_pw(zclient, ZEBRA_PW_SET, zpw));
+ return zebra_send_pw(zclient, ZEBRA_PW_SET, zpw)
+ == ZCLIENT_SEND_FAILURE;
}
int
debug_zebra_out("pseudowire %s nexthop %s (unset)",
zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop));
- return (zebra_send_pw(zclient, ZEBRA_PW_UNSET, zpw));
+ return zebra_send_pw(zclient, ZEBRA_PW_UNSET, zpw)
+ == ZCLIENT_SEND_FAILURE;
}
void
}
/* Send simple Zebra message. */
-static int zebra_message_send(struct zclient *zclient, int command,
- vrf_id_t vrf_id)
+static enum zclient_send_status zebra_message_send(struct zclient *zclient,
+ int command, vrf_id_t vrf_id)
{
struct stream *s;
return zclient_send_message(zclient);
}
-int zclient_send_hello(struct zclient *zclient)
+enum zclient_send_status zclient_send_hello(struct zclient *zclient)
{
struct stream *s;
return zclient_send_message(zclient);
}
- return 0;
+ return ZCLIENT_SEND_SUCCESS;
}
-int zclient_send_vrf_label(struct zclient *zclient, vrf_id_t vrf_id, afi_t afi,
- mpls_label_t label, enum lsp_types_t ltype)
+enum zclient_send_status zclient_send_vrf_label(struct zclient *zclient,
+ vrf_id_t vrf_id, afi_t afi,
+ mpls_label_t label,
+ enum lsp_types_t ltype)
{
struct stream *s;
}
}
-int zclient_send_router_id_update(struct zclient *zclient,
- zebra_message_types_t type, afi_t afi,
- vrf_id_t vrf_id)
+enum zclient_send_status
+zclient_send_router_id_update(struct zclient *zclient,
+ zebra_message_types_t type, afi_t afi,
+ vrf_id_t vrf_id)
{
struct stream *s = zclient->obuf;
stream_reset(s);
}
/* Send request to zebra daemon to start or stop RA. */
-int zclient_send_interface_radv_req(struct zclient *zclient, vrf_id_t vrf_id,
- struct interface *ifp, int enable,
- int ra_interval)
+enum zclient_send_status
+zclient_send_interface_radv_req(struct zclient *zclient, vrf_id_t vrf_id,
+ struct interface *ifp, int enable,
+ int ra_interval)
{
struct stream *s;
/* If not connected to the zebra yet. */
if (zclient->sock < 0)
- return -1;
+ return ZCLIENT_SEND_FAILURE;
/* Form and send message. */
s = zclient->obuf;
return zclient_send_message(zclient);
}
-int zclient_send_interface_protodown(struct zclient *zclient, vrf_id_t vrf_id,
- struct interface *ifp, bool down)
+enum zclient_send_status
+zclient_send_interface_protodown(struct zclient *zclient, vrf_id_t vrf_id,
+ struct interface *ifp, bool down)
{
struct stream *s;
if (zclient->sock < 0)
- return -1;
+ return ZCLIENT_SEND_FAILURE;
s = zclient->obuf;
stream_reset(s);
return zclient_start(zclient);
}
-int zclient_send_rnh(struct zclient *zclient, int command,
- const struct prefix *p, bool exact_match,
- vrf_id_t vrf_id)
+enum zclient_send_status zclient_send_rnh(struct zclient *zclient, int command,
+ const struct prefix *p,
+ bool exact_match, vrf_id_t vrf_id)
{
struct stream *s;
return 0;
}
-int zclient_nhg_send(struct zclient *zclient, int cmd, struct zapi_nhg *api_nhg)
+enum zclient_send_status zclient_nhg_send(struct zclient *zclient, int cmd,
+ struct zapi_nhg *api_nhg)
{
api_nhg->proto = zclient->redist_default;
* then set/unset redist[type] in the client handle (a struct zserv) for the
* sending client
*/
-int zebra_redistribute_send(int command, struct zclient *zclient, afi_t afi,
- int type, unsigned short instance, vrf_id_t vrf_id)
+enum zclient_send_status
+zebra_redistribute_send(int command, struct zclient *zclient, afi_t afi,
+ int type, unsigned short instance, vrf_id_t vrf_id)
{
struct stream *s;
return zclient_send_message(zclient);
}
-int zebra_redistribute_default_send(int command, struct zclient *zclient,
- afi_t afi, vrf_id_t vrf_id)
+enum zclient_send_status
+zebra_redistribute_default_send(int command, struct zclient *zclient, afi_t afi,
+ vrf_id_t vrf_id)
{
struct stream *s;
* @param base Base for the label chunk. if MPLS_LABEL_BASE_ANY we do not care
* @result 0 on success, -1 otherwise
*/
-int zclient_send_get_label_chunk(struct zclient *zclient, uint8_t keep,
- uint32_t chunk_size, uint32_t base)
+enum zclient_send_status zclient_send_get_label_chunk(struct zclient *zclient,
+ uint8_t keep,
+ uint32_t chunk_size,
+ uint32_t base)
{
struct stream *s;
zlog_debug("Getting Label Chunk");
if (zclient->sock < 0)
- return -1;
+ return ZCLIENT_SEND_FAILURE;
s = zclient->obuf;
stream_reset(s);
zlog_debug("Connecting to Table Manager");
if (zclient->sock < 0)
- return -1;
+ return ZCLIENT_SEND_FAILURE;
/* send request */
s = zclient->obuf;
stream_putw_at(s, 0, stream_get_endp(s));
ret = zclient_send_message(zclient);
- if (ret < 0)
+ if (ret == ZCLIENT_SEND_FAILURE)
return -1;
if (zclient_debug)
/* Put length at the first point of the stream. */
stream_putw_at(s, 0, stream_get_endp(s));
- return zclient_send_message(zclient);
+ if (zclient_send_message(zclient) == ZCLIENT_SEND_FAILURE)
+ return -1;
+
+ return 0;
}
-int zebra_send_sr_policy(struct zclient *zclient, int cmd,
- struct zapi_sr_policy *zp)
+enum zclient_send_status zebra_send_sr_policy(struct zclient *zclient, int cmd,
+ struct zapi_sr_policy *zp)
{
if (zapi_sr_policy_encode(zclient->obuf, cmd, zp) < 0)
- return -1;
+ return ZCLIENT_SEND_FAILURE;
return zclient_send_message(zclient);
}
return -1;
}
-int zebra_send_mpls_labels(struct zclient *zclient, int cmd,
- struct zapi_labels *zl)
+enum zclient_send_status zebra_send_mpls_labels(struct zclient *zclient,
+ int cmd, struct zapi_labels *zl)
{
if (zapi_labels_encode(zclient->obuf, cmd, zl) < 0)
- return -1;
+ return ZCLIENT_SEND_FAILURE;
return zclient_send_message(zclient);
}
return -1;
}
-int zebra_send_pw(struct zclient *zclient, int command, struct zapi_pw *pw)
+enum zclient_send_status zebra_send_pw(struct zclient *zclient, int command,
+ struct zapi_pw *pw)
{
struct stream *s;
break;
default:
flog_err(EC_LIB_ZAPI_ENCODE, "%s: unknown af", __func__);
- return -1;
+ return ZCLIENT_SEND_FAILURE;
}
/* Put labels */
return;
}
-int zclient_send_mlag_register(struct zclient *client, uint32_t bit_map)
+enum zclient_send_status zclient_send_mlag_register(struct zclient *client,
+ uint32_t bit_map)
{
struct stream *s;
return zclient_send_message(client);
}
-int zclient_send_mlag_deregister(struct zclient *client)
+enum zclient_send_status zclient_send_mlag_deregister(struct zclient *client)
{
return zebra_message_send(client, ZEBRA_MLAG_CLIENT_UNREGISTER, VRF_DEFAULT);
}
-int zclient_send_mlag_data(struct zclient *client, struct stream *client_s)
+enum zclient_send_status zclient_send_mlag_data(struct zclient *client,
+ struct stream *client_s)
{
struct stream *s;
* Send an OPAQUE message, contents opaque to zebra. The message header
* is a message subtype.
*/
-int zclient_send_opaque(struct zclient *zclient, uint32_t type,
- const uint8_t *data, size_t datasize)
+enum zclient_send_status zclient_send_opaque(struct zclient *zclient,
+ uint32_t type, const uint8_t *data,
+ size_t datasize)
{
struct stream *s;
uint16_t flags = 0;
/* Check buffer size */
if (STREAM_SIZE(zclient->obuf) <
(ZEBRA_HEADER_SIZE + sizeof(type) + datasize))
- return -1;
+ return ZCLIENT_SEND_FAILURE;
s = zclient->obuf;
stream_reset(s);
* Send an OPAQUE message to a specific zclient. The contents are opaque
* to zebra.
*/
-int zclient_send_opaque_unicast(struct zclient *zclient, uint32_t type,
- uint8_t proto, uint16_t instance,
- uint32_t session_id, const uint8_t *data,
- size_t datasize)
+enum zclient_send_status
+zclient_send_opaque_unicast(struct zclient *zclient, uint32_t type,
+ uint8_t proto, uint16_t instance,
+ uint32_t session_id, const uint8_t *data,
+ size_t datasize)
{
struct stream *s;
uint16_t flags = 0;
/* Check buffer size */
if (STREAM_SIZE(zclient->obuf) <
(ZEBRA_HEADER_SIZE + sizeof(struct zapi_opaque_msg) + datasize))
- return -1;
+ return ZCLIENT_SEND_FAILURE;
s = zclient->obuf;
stream_reset(s);
/*
* Send a registration request for opaque messages with a specified subtype.
*/
-int zclient_register_opaque(struct zclient *zclient, uint32_t type)
+enum zclient_send_status zclient_register_opaque(struct zclient *zclient,
+ uint32_t type)
{
struct stream *s;
/*
* Send an un-registration request for a specified opaque subtype.
*/
-int zclient_unregister_opaque(struct zclient *zclient, uint32_t type)
+enum zclient_send_status zclient_unregister_opaque(struct zclient *zclient,
+ uint32_t type)
{
struct stream *s;
}
}
-int zclient_interface_set_master(struct zclient *client,
- struct interface *master,
- struct interface *slave)
+enum zclient_send_status zclient_interface_set_master(struct zclient *client,
+ struct interface *master,
+ struct interface *slave)
{
struct stream *s;
/*
* Send capabilities message to zebra
*/
-int32_t zclient_capabilities_send(uint32_t cmd, struct zclient *zclient,
- struct zapi_cap *api)
+enum zclient_send_status zclient_capabilities_send(uint32_t cmd,
+ struct zclient *zclient,
+ struct zapi_cap *api)
{
struct stream *s;
if (zclient == NULL)
- return -1;
+ return ZCLIENT_SEND_FAILURE;
s = zclient->obuf;
stream_reset(s);
return 0;
}
-int zclient_send_neigh_discovery_req(struct zclient *zclient,
- const struct interface *ifp,
- const struct prefix *p)
+enum zclient_send_status
+zclient_send_neigh_discovery_req(struct zclient *zclient,
+ const struct interface *ifp,
+ const struct prefix *p)
{
struct stream *s;
* we have installed and play some special games
* to get them both installed.
*/
-extern int zclient_send_vrf_label(struct zclient *zclient, vrf_id_t vrf_id,
- afi_t afi, mpls_label_t label,
- enum lsp_types_t ltype);
+extern enum zclient_send_status
+zclient_send_vrf_label(struct zclient *zclient, vrf_id_t vrf_id, afi_t afi,
+ mpls_label_t label, enum lsp_types_t ltype);
extern void zclient_send_reg_requests(struct zclient *, vrf_id_t);
extern void zclient_send_dereg_requests(struct zclient *, vrf_id_t);
-extern int zclient_send_router_id_update(struct zclient *zclient,
- zebra_message_types_t type, afi_t afi,
- vrf_id_t vrf_id);
-
-extern int zclient_send_interface_radv_req(struct zclient *zclient,
- vrf_id_t vrf_id,
- struct interface *ifp, int enable,
- int ra_interval);
-extern int zclient_send_interface_protodown(struct zclient *zclient,
- vrf_id_t vrf_id,
- struct interface *ifp, bool down);
+extern enum zclient_send_status
+zclient_send_router_id_update(struct zclient *zclient,
+ zebra_message_types_t type, afi_t afi,
+ vrf_id_t vrf_id);
+
+extern enum zclient_send_status
+zclient_send_interface_radv_req(struct zclient *zclient, vrf_id_t vrf_id,
+ struct interface *ifp, int enable,
+ int ra_interval);
+extern enum zclient_send_status
+zclient_send_interface_protodown(struct zclient *zclient, vrf_id_t vrf_id,
+ struct interface *ifp, bool down);
/* Send redistribute command to zebra daemon. Do not update zclient state. */
-extern int zebra_redistribute_send(int command, struct zclient *, afi_t,
- int type, unsigned short instance,
- vrf_id_t vrf_id);
+extern enum zclient_send_status
+zebra_redistribute_send(int command, struct zclient *, afi_t, int type,
+ unsigned short instance, vrf_id_t vrf_id);
-extern int zebra_redistribute_default_send(int command, struct zclient *zclient,
- afi_t afi, vrf_id_t vrf_id);
+extern enum zclient_send_status
+zebra_redistribute_default_send(int command, struct zclient *zclient, afi_t afi,
+ vrf_id_t vrf_id);
/* Send route notify request to zebra */
extern int zebra_route_notify_send(int command, struct zclient *zclient,
*/
extern bool zapi_parse_header(struct stream *zmsg, struct zmsghdr *hdr);
-extern int zclient_interface_set_master(struct zclient *client,
- struct interface *master,
- struct interface *slave);
+extern enum zclient_send_status
+zclient_interface_set_master(struct zclient *client, struct interface *master,
+ struct interface *slave);
extern struct interface *zebra_interface_state_read(struct stream *s, vrf_id_t);
extern struct connected *zebra_interface_address_read(int, struct stream *,
vrf_id_t);
vrf_id_t vrf_id);
extern size_t zebra_interface_link_params_write(struct stream *,
struct interface *);
-extern int zclient_send_get_label_chunk(struct zclient *zclient, uint8_t keep,
- uint32_t chunk_size, uint32_t base);
+extern enum zclient_send_status
+zclient_send_get_label_chunk(struct zclient *zclient, uint8_t keep,
+ uint32_t chunk_size, uint32_t base);
extern int lm_label_manager_connect(struct zclient *zclient, int async);
extern int lm_get_label_chunk(struct zclient *zclient, uint8_t keep,
extern int tm_release_table_chunk(struct zclient *zclient, uint32_t start,
uint32_t end);
-extern int zebra_send_sr_policy(struct zclient *zclient, int cmd,
- struct zapi_sr_policy *zp);
+extern enum zclient_send_status zebra_send_sr_policy(struct zclient *zclient,
+ int cmd,
+ struct zapi_sr_policy *zp);
extern int zapi_sr_policy_encode(struct stream *s, int cmd,
struct zapi_sr_policy *zp);
extern int zapi_sr_policy_decode(struct stream *s, struct zapi_sr_policy *zp);
extern int zapi_sr_policy_notify_status_decode(struct stream *s,
struct zapi_sr_policy *zp);
-extern int zebra_send_mpls_labels(struct zclient *zclient, int cmd,
- struct zapi_labels *zl);
+extern enum zclient_send_status zebra_send_mpls_labels(struct zclient *zclient,
+ int cmd,
+ struct zapi_labels *zl);
extern int zapi_labels_encode(struct stream *s, int cmd,
struct zapi_labels *zl);
extern int zapi_labels_decode(struct stream *s, struct zapi_labels *zl);
-extern int zebra_send_pw(struct zclient *zclient, int command,
- struct zapi_pw *pw);
+extern enum zclient_send_status zebra_send_pw(struct zclient *zclient,
+ int command, struct zapi_pw *pw);
extern int zebra_read_pw_status_update(ZAPI_CALLBACK_ARGS,
struct zapi_pw_status *pw);
extern enum zclient_send_status zclient_route_send(uint8_t, struct zclient *,
struct zapi_route *);
-extern int zclient_send_rnh(struct zclient *zclient, int command,
- const struct prefix *p, bool exact_match,
- vrf_id_t vrf_id);
+extern enum zclient_send_status
+zclient_send_rnh(struct zclient *zclient, int command, const struct prefix *p,
+ bool exact_match, vrf_id_t vrf_id);
int zapi_nexthop_encode(struct stream *s, const struct zapi_nexthop *api_nh,
uint32_t api_flags, uint32_t api_message);
extern int zapi_route_encode(uint8_t, struct stream *, struct zapi_route *);
extern int zapi_nhg_encode(struct stream *s, int cmd, struct zapi_nhg *api_nhg);
extern int zapi_nhg_decode(struct stream *s, int cmd, struct zapi_nhg *api_nhg);
-extern int zclient_nhg_send(struct zclient *zclient, int cmd,
- struct zapi_nhg *api_nhg);
+extern enum zclient_send_status
+zclient_nhg_send(struct zclient *zclient, int cmd, struct zapi_nhg *api_nhg);
#define ZEBRA_IPSET_NAME_SIZE 32
extern bool zapi_error_decode(struct stream *s, enum zebra_error_types *error);
/* Encode and decode restart capabilities */
-extern int32_t zclient_capabilities_send(uint32_t cmd, struct zclient *zclient,
- struct zapi_cap *api);
+extern enum zclient_send_status
+zclient_capabilities_send(uint32_t cmd, struct zclient *zclient,
+ struct zapi_cap *api);
extern int32_t zapi_capabilities_decode(struct stream *s, struct zapi_cap *api);
static inline void zapi_route_set_blackhole(struct zapi_route *api,
SET_FLAG(api->message, ZAPI_MESSAGE_NEXTHOP);
};
-extern int zclient_send_mlag_register(struct zclient *client,
- uint32_t bit_map);
-extern int zclient_send_mlag_deregister(struct zclient *client);
+extern enum zclient_send_status
+zclient_send_mlag_register(struct zclient *client, uint32_t bit_map);
+extern enum zclient_send_status
+zclient_send_mlag_deregister(struct zclient *client);
-extern int zclient_send_mlag_data(struct zclient *client,
- struct stream *client_s);
+extern enum zclient_send_status zclient_send_mlag_data(struct zclient *client,
+ struct stream *client_s);
/*
* Send an OPAQUE message, contents opaque to zebra - but note that
* below to avoid sub-type collisions. Clients use the registration
* apis to manage the specific opaque subtypes they want to receive.
*/
-int zclient_send_opaque(struct zclient *zclient, uint32_t type,
- const uint8_t *data, size_t datasize);
+enum zclient_send_status zclient_send_opaque(struct zclient *zclient,
+ uint32_t type, const uint8_t *data,
+ size_t datasize);
-int zclient_send_opaque_unicast(struct zclient *zclient, uint32_t type,
- uint8_t proto, uint16_t instance,
- uint32_t session_id, const uint8_t *data,
- size_t datasize);
+enum zclient_send_status
+zclient_send_opaque_unicast(struct zclient *zclient, uint32_t type,
+ uint8_t proto, uint16_t instance,
+ uint32_t session_id, const uint8_t *data,
+ size_t datasize);
/* Struct representing the decoded opaque header info */
struct zapi_opaque_msg {
/* Decode incoming opaque */
int zclient_opaque_decode(struct stream *msg, struct zapi_opaque_msg *info);
-int zclient_register_opaque(struct zclient *zclient, uint32_t type);
-int zclient_unregister_opaque(struct zclient *zclient, uint32_t type);
+enum zclient_send_status zclient_register_opaque(struct zclient *zclient,
+ uint32_t type);
+enum zclient_send_status zclient_unregister_opaque(struct zclient *zclient,
+ uint32_t type);
int zapi_opaque_reg_decode(struct stream *msg,
struct zapi_opaque_reg_info *info);
/* Send the hello message.
* Returns 0 for success or -1 on an I/O error.
*/
-extern int zclient_send_hello(struct zclient *client);
+extern enum zclient_send_status zclient_send_hello(struct zclient *client);
-extern int zclient_send_neigh_discovery_req(struct zclient *zclient,
- const struct interface *ifp,
- const struct prefix *p);
+extern enum zclient_send_status
+zclient_send_neigh_discovery_req(struct zclient *zclient,
+ const struct interface *ifp,
+ const struct prefix *p);
#ifdef __cplusplus
}
set_nonblocking(zclient_sync->sock);
/* Send hello to notify zebra this is a synchronous client */
- if (zclient_send_hello(zclient_sync) < 0) {
+ if (zclient_send_hello(zclient_sync) == ZCLIENT_SEND_FAILURE) {
zlog_warn("%s: failed sending hello for synchronous zclient!",
__func__);
close(zclient_sync->sock);
break;
}
- if (zclient_send_rnh(zclient, command, &p,
- false, nhop->vrf_id) < 0) {
+ if (zclient_send_rnh(zclient, command, &p, false, nhop->vrf_id)
+ == ZCLIENT_SEND_FAILURE) {
zlog_warn("%s: Failure to send nexthop to zebra", __func__);
}
}
p = &(pnc->rpf.rpf_addr);
ret = zclient_send_rnh(zclient, command, p, false, pim->vrf_id);
- if (ret < 0)
+ if (ret == ZCLIENT_SEND_FAILURE)
zlog_warn("sendmsg_nexthop: zclient_send_message() failed");
if (PIM_DEBUG_PIM_NHT)
zlookup->fail = 0; /* reset counter on connection */
}
- if (zclient_send_hello(zlookup) < 0) {
+ if (zclient_send_hello(zlookup) == ZCLIENT_SEND_FAILURE) {
if (close(zlookup->sock)) {
zlog_warn("%s: closing fd=%d: errno=%d %s", __func__,
zlookup->sock, errno, safe_strerror(errno));
cmd = ZEBRA_MPLS_LABELS_DELETE;
}
- ret = zebra_send_mpls_labels(zclient, cmd, &zl);
+ if (zebra_send_mpls_labels(zclient, cmd, &zl) == ZCLIENT_SEND_FAILURE)
+ return -1;
- return ret;
+ return 0;
}
enum where_to_restart {
command = ZEBRA_IMPORT_ROUTE_UNREGISTER;
}
- if (zclient_send_rnh(zclient, command, p, connected, vrf_id) < 0)
+ if (zclient_send_rnh(zclient, command, p, connected, vrf_id)
+ == ZCLIENT_SEND_FAILURE)
zlog_warn("%s: Failure to send nexthop to zebra", __func__);
}
ret = zclient_send_opaque_unicast(zclient, type, proto,
instance, session_id,
buf, sizeof(buf));
- if (ret < 0) {
+ if (ret == ZCLIENT_SEND_FAILURE) {
zlog_debug("%s: send_opaque() failed => %d",
__func__, ret);
break;
static_nht_hash_free(nhtd);
}
- if (zclient_send_rnh(zclient, cmd, &p, false, nh->nh_vrf_id) < 0)
+ if (zclient_send_rnh(zclient, cmd, &p, false, nh->nh_vrf_id)
+ == ZCLIENT_SEND_FAILURE)
zlog_warn("%s: Failure to send nexthop to zebra", __func__);
}
/*
enable, VRRP_RADV_INT);
}
-int vrrp_zclient_send_interface_protodown(struct interface *ifp, bool down)
+void vrrp_zclient_send_interface_protodown(struct interface *ifp, bool down)
{
DEBUGD(&vrrp_dbg_zebra,
VRRP_LOGPFX "Requesting Zebra to set %s protodown %s", ifp->name,
down ? "on" : "off");
- return zclient_send_interface_protodown(zclient, ifp->vrf_id, ifp,
- down);
+ zclient_send_interface_protodown(zclient, ifp->vrf_id, ifp, down);
}
void vrrp_zebra_init(void)
extern void vrrp_zebra_init(void);
extern void vrrp_zebra_radv_set(struct vrrp_router *r, bool enable);
-extern int vrrp_zclient_send_interface_protodown(struct interface *ifp,
- bool down);
+extern void vrrp_zclient_send_interface_protodown(struct interface *ifp,
+ bool down);
extern int vrrp_ifp_create(struct interface *ifp);
extern int vrrp_ifp_up(struct interface *ifp);