diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-09-13 19:34:28 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-09-13 19:34:28 +0000 |
| commit | 450971aa994e68f7c62c4d45065223d5cfc4a22f (patch) | |
| tree | 0128a1e596823272333d8a6616dd2575e8d7c46b /lib/zclient.c | |
| parent | e914ccbe9cfb45bbb0ce61bb496e27df6b6136ba (diff) | |
*: LIB_[ERR|WARN] -> EC_LIB
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/zclient.c')
| -rw-r--r-- | lib/zclient.c | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/lib/zclient.c b/lib/zclient.c index 340eb0db33..56c47d2b19 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -250,7 +250,7 @@ static int zclient_flush_data(struct thread *thread) switch (buffer_flush_available(zclient->wb, zclient->sock)) { case BUFFER_ERROR: flog_err( - LIB_ERR_ZAPI_SOCKET, + EC_LIB_ZAPI_SOCKET, "%s: buffer_flush_available failed on zclient fd %d, closing", __func__, zclient->sock); return zclient_failed(zclient); @@ -274,7 +274,7 @@ int zclient_send_message(struct zclient *zclient) STREAM_DATA(zclient->obuf), stream_get_endp(zclient->obuf))) { case BUFFER_ERROR: - flog_err(LIB_ERR_ZAPI_SOCKET, + flog_err(EC_LIB_ZAPI_SOCKET, "%s: buffer_write failed to zclient fd %d, closing", __func__, zclient->sock); return zclient_failed(zclient); @@ -315,7 +315,7 @@ int zclient_read_header(struct stream *s, int sock, uint16_t *size, STREAM_GETW(s, *cmd); if (*version != ZSERV_VERSION || *marker != ZEBRA_HEADER_MARKER) { - flog_err(LIB_ERR_ZAPI_MISSMATCH, + flog_err(EC_LIB_ZAPI_MISSMATCH, "%s: socket %d version mismatch, marker %d, version %d", __func__, sock, *marker, *version); return -1; @@ -577,7 +577,7 @@ int zclient_start(struct zclient *zclient) } if (set_nonblocking(zclient->sock) < 0) - flog_err(LIB_ERR_ZAPI_SOCKET, "%s: set_nonblocking(%d) failed", + flog_err(EC_LIB_ZAPI_SOCKET, "%s: set_nonblocking(%d) failed", __func__, zclient->sock); /* Clear fail count. */ @@ -774,7 +774,7 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api) prefix2str(&api->prefix, buf, sizeof(buf)); flog_err( - LIB_ERR_ZAPI_ENCODE, + EC_LIB_ZAPI_ENCODE, "%s: prefix %s: can't encode %u nexthops (maximum is %u)", __func__, buf, api->nexthop_num, MULTIPATH_NUM); return -1; @@ -818,7 +818,7 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api) char buf[PREFIX2STR_BUFFER]; prefix2str(&api->prefix, buf, sizeof(buf)); - flog_err(LIB_ERR_ZAPI_ENCODE, + flog_err(EC_LIB_ZAPI_ENCODE, "%s: prefix %s: can't encode " "%u labels (maximum is %u)", __func__, buf, @@ -868,7 +868,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api) /* Type, flags, message. */ STREAM_GETC(s, api->type); if (api->type > ZEBRA_ROUTE_MAX) { - flog_err(LIB_ERR_ZAPI_ENCODE, + flog_err(EC_LIB_ZAPI_ENCODE, "%s: Specified route type: %d is not a legal value\n", __PRETTY_FUNCTION__, api->type); return -1; @@ -886,7 +886,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api) case AF_INET: if (api->prefix.prefixlen > IPV4_MAX_PREFIXLEN) { flog_err( - LIB_ERR_ZAPI_ENCODE, + EC_LIB_ZAPI_ENCODE, "%s: V4 prefixlen is %d which should not be more than 32", __PRETTY_FUNCTION__, api->prefix.prefixlen); return -1; @@ -895,14 +895,14 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api) case AF_INET6: if (api->prefix.prefixlen > IPV6_MAX_PREFIXLEN) { flog_err( - LIB_ERR_ZAPI_ENCODE, + EC_LIB_ZAPI_ENCODE, "%s: v6 prefixlen is %d which should not be more than 128", __PRETTY_FUNCTION__, api->prefix.prefixlen); return -1; } break; default: - flog_err(LIB_ERR_ZAPI_ENCODE, + flog_err(EC_LIB_ZAPI_ENCODE, "%s: Specified family %d is not v4 or v6", __PRETTY_FUNCTION__, api->prefix.family); return -1; @@ -914,7 +914,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api) STREAM_GETC(s, api->src_prefix.prefixlen); if (api->src_prefix.prefixlen > IPV6_MAX_PREFIXLEN) { flog_err( - LIB_ERR_ZAPI_ENCODE, + EC_LIB_ZAPI_ENCODE, "%s: SRC Prefix prefixlen received: %d is too large", __PRETTY_FUNCTION__, api->src_prefix.prefixlen); return -1; @@ -925,7 +925,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api) if (api->prefix.family != AF_INET6 || api->src_prefix.prefixlen == 0) { flog_err( - LIB_ERR_ZAPI_ENCODE, + EC_LIB_ZAPI_ENCODE, "%s: SRC prefix specified in some manner that makes no sense", __PRETTY_FUNCTION__); return -1; @@ -936,7 +936,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api) if (CHECK_FLAG(api->message, ZAPI_MESSAGE_NEXTHOP)) { STREAM_GETW(s, api->nexthop_num); if (api->nexthop_num > MULTIPATH_NUM) { - flog_err(LIB_ERR_ZAPI_ENCODE, + flog_err(EC_LIB_ZAPI_ENCODE, "%s: invalid number of nexthops (%u)", __func__, api->nexthop_num); return -1; @@ -978,7 +978,7 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api) if (api_nh->label_num > MPLS_MAX_LABELS) { flog_err( - LIB_ERR_ZAPI_ENCODE, + EC_LIB_ZAPI_ENCODE, "%s: invalid number of MPLS labels (%u)", __func__, api_nh->label_num); return -1; @@ -1238,7 +1238,7 @@ bool zapi_nexthop_update_decode(struct stream *s, struct zapi_route *nhr) } STREAM_GETC(s, nhr->nexthops[i].label_num); if (nhr->nexthops[i].label_num > MPLS_MAX_LABELS) { - flog_err(LIB_ERR_ZAPI_ENCODE, + flog_err(EC_LIB_ZAPI_ENCODE, "%s: invalid number of MPLS labels (%u)", __func__, nhr->nexthops[i].label_num); return false; @@ -1424,7 +1424,7 @@ struct interface *zebra_interface_state_read(struct stream *s, vrf_id_t vrf_id) /* Lookup this by interface index. */ ifp = if_lookup_by_name(ifname_tmp, vrf_id); if (ifp == NULL) { - flog_err(LIB_ERR_ZAPI_ENCODE, + flog_err(EC_LIB_ZAPI_ENCODE, "INTERFACE_STATE: Cannot find IF %s in VRF %d", ifname_tmp, vrf_id); return NULL; @@ -1451,7 +1451,7 @@ static void link_params_set_value(struct stream *s, struct if_link_params *iflp) for (i = 0; i < bwclassnum && i < MAX_CLASS_TYPE; i++) iflp->unrsv_bw[i] = stream_getf(s); if (i < bwclassnum) - flog_err(LIB_ERR_ZAPI_MISSMATCH, + flog_err(EC_LIB_ZAPI_MISSMATCH, "%s: received %d > %d (MAX_CLASS_TYPE) bw entries" " - outdated library?", __func__, bwclassnum, MAX_CLASS_TYPE); @@ -1483,7 +1483,7 @@ struct interface *zebra_interface_link_params_read(struct stream *s) struct interface *ifp = if_lookup_by_index(ifindex, VRF_DEFAULT); if (ifp == NULL) { - flog_err(LIB_ERR_ZAPI_ENCODE, + flog_err(EC_LIB_ZAPI_ENCODE, "%s: unknown ifindex %u, shouldn't happen", __func__, ifindex); return NULL; @@ -1634,7 +1634,7 @@ struct connected *zebra_interface_address_read(int type, struct stream *s, /* Lookup index. */ ifp = if_lookup_by_index(ifindex, vrf_id); if (ifp == NULL) { - flog_err(LIB_ERR_ZAPI_ENCODE, + flog_err(EC_LIB_ZAPI_ENCODE, "INTERFACE_ADDRESS_%s: Cannot find IF %u in VRF %d", (type == ZEBRA_INTERFACE_ADDRESS_ADD) ? "ADD" : "DEL", ifindex, vrf_id); @@ -1673,7 +1673,7 @@ struct connected *zebra_interface_address_read(int type, struct stream *s, * "peer" */ char buf[PREFIX_STRLEN]; flog_err( - LIB_ERR_ZAPI_ENCODE, + EC_LIB_ZAPI_ENCODE, "warning: interface %s address %s with peer flag set, but no peer address!", ifp->name, prefix2str(ifc->address, buf, @@ -1727,7 +1727,7 @@ zebra_interface_nbr_address_read(int type, struct stream *s, vrf_id_t vrf_id) /* Lookup index. */ ifp = if_lookup_by_index(ifindex, vrf_id); if (ifp == NULL) { - flog_err(LIB_ERR_ZAPI_ENCODE, + flog_err(EC_LIB_ZAPI_ENCODE, "INTERFACE_NBR_%s: Cannot find IF %u in VRF %d", (type == ZEBRA_INTERFACE_NBR_ADDRESS_ADD) ? "ADD" : "DELETE", @@ -1777,7 +1777,7 @@ struct interface *zebra_interface_vrf_update_read(struct stream *s, /* Lookup interface. */ ifp = if_lookup_by_index(ifindex, vrf_id); if (ifp == NULL) { - flog_err(LIB_ERR_ZAPI_ENCODE, + flog_err(EC_LIB_ZAPI_ENCODE, "INTERFACE_VRF_UPDATE: Cannot find IF %u in VRF %d", ifindex, vrf_id); return NULL; @@ -1823,7 +1823,7 @@ static int zclient_read_sync_response(struct zclient *zclient, size); } if (ret != 0) { - flog_err(LIB_ERR_ZAPI_ENCODE, + flog_err(EC_LIB_ZAPI_ENCODE, "%s: Invalid Sync Message Reply", __func__); return -1; } @@ -1866,13 +1866,13 @@ int lm_label_manager_connect(struct zclient *zclient) ret = writen(zclient->sock, s->data, stream_get_endp(s)); if (ret < 0) { - flog_err(LIB_ERR_ZAPI_SOCKET, "Can't write to zclient sock"); + flog_err(EC_LIB_ZAPI_SOCKET, "Can't write to zclient sock"); close(zclient->sock); zclient->sock = -1; return -1; } if (ret == 0) { - flog_err(LIB_ERR_ZAPI_SOCKET, "Zclient sock closed"); + flog_err(EC_LIB_ZAPI_SOCKET, "Zclient sock closed"); close(zclient->sock); zclient->sock = -1; return -1; @@ -1893,11 +1893,11 @@ int lm_label_manager_connect(struct zclient *zclient) /* sanity */ if (proto != zclient->redist_default) - flog_err(LIB_ERR_ZAPI_ENCODE, + flog_err(EC_LIB_ZAPI_ENCODE, "Wrong proto (%u) in LM connect response. Should be %u", proto, zclient->redist_default); if (instance != zclient->instance) - flog_err(LIB_ERR_ZAPI_ENCODE, + flog_err(EC_LIB_ZAPI_ENCODE, "Wrong instId (%u) in LM connect response. Should be %u", instance, zclient->instance); @@ -1988,14 +1988,14 @@ int lm_get_label_chunk(struct zclient *zclient, uint8_t keep, ret = writen(zclient->sock, s->data, stream_get_endp(s)); if (ret < 0) { - flog_err(LIB_ERR_ZAPI_SOCKET, + flog_err(EC_LIB_ZAPI_SOCKET, "Can't write to zclient sock"); close(zclient->sock); zclient->sock = -1; return -1; } if (ret == 0) { - flog_err(LIB_ERR_ZAPI_SOCKET, + flog_err(EC_LIB_ZAPI_SOCKET, "Zclient sock closed"); close(zclient->sock); zclient->sock = -1; @@ -2017,11 +2017,11 @@ int lm_get_label_chunk(struct zclient *zclient, uint8_t keep, /* sanities */ if (proto != zclient->redist_default) - flog_err(LIB_ERR_ZAPI_ENCODE, + flog_err(EC_LIB_ZAPI_ENCODE, "Wrong proto (%u) in get chunk response. Should be %u", proto, zclient->redist_default); if (instance != zclient->instance) - flog_err(LIB_ERR_ZAPI_ENCODE, + flog_err(EC_LIB_ZAPI_ENCODE, "Wrong instId (%u) in get chunk response Should be %u", instance, zclient->instance); @@ -2033,14 +2033,14 @@ int lm_get_label_chunk(struct zclient *zclient, uint8_t keep, /* not owning this response */ if (keep != response_keep) { - flog_err(LIB_ERR_ZAPI_ENCODE, + flog_err(EC_LIB_ZAPI_ENCODE, "Invalid Label chunk: %u - %u, keeps mismatch %u != %u", *start, *end, keep, response_keep); } /* sanity */ if (*start > *end || *start < MPLS_LABEL_UNRESERVED_MIN || *end > MPLS_LABEL_UNRESERVED_MAX) { - flog_err(LIB_ERR_ZAPI_ENCODE, + flog_err(EC_LIB_ZAPI_ENCODE, "Invalid Label chunk: %u - %u", *start, *end); return -1; } @@ -2091,13 +2091,13 @@ int lm_release_label_chunk(struct zclient *zclient, uint32_t start, ret = writen(zclient->sock, s->data, stream_get_endp(s)); if (ret < 0) { - flog_err(LIB_ERR_ZAPI_SOCKET, "Can't write to zclient sock"); + flog_err(EC_LIB_ZAPI_SOCKET, "Can't write to zclient sock"); close(zclient->sock); zclient->sock = -1; return -1; } if (ret == 0) { - flog_err(LIB_ERR_ZAPI_SOCKET, + flog_err(EC_LIB_ZAPI_SOCKET, "Zclient sock connection closed"); close(zclient->sock); zclient->sock = -1; @@ -2201,14 +2201,14 @@ int tm_get_table_chunk(struct zclient *zclient, uint32_t chunk_size, ret = writen(zclient->sock, s->data, stream_get_endp(s)); if (ret < 0) { - flog_err(LIB_ERR_ZAPI_SOCKET, + flog_err(EC_LIB_ZAPI_SOCKET, "%s: can't write to zclient->sock", __func__); close(zclient->sock); zclient->sock = -1; return -1; } if (ret == 0) { - flog_err(LIB_ERR_ZAPI_SOCKET, + flog_err(EC_LIB_ZAPI_SOCKET, "%s: zclient->sock connection closed", __func__); close(zclient->sock); zclient->sock = -1; @@ -2295,7 +2295,7 @@ int zebra_send_pw(struct zclient *zclient, int command, struct zapi_pw *pw) stream_write(s, (uint8_t *)&pw->nexthop.ipv6, 16); break; default: - flog_err(LIB_ERR_ZAPI_ENCODE, + flog_err(EC_LIB_ZAPI_ENCODE, "%s: unknown af", __func__); return -1; } @@ -2398,14 +2398,14 @@ static int zclient_read(struct thread *thread) command = stream_getw(zclient->ibuf); if (marker != ZEBRA_HEADER_MARKER || version != ZSERV_VERSION) { - flog_err(LIB_ERR_ZAPI_MISSMATCH, + flog_err(EC_LIB_ZAPI_MISSMATCH, "%s: socket %d version mismatch, marker %d, version %d", __func__, zclient->sock, marker, version); return zclient_failed(zclient); } if (length < ZEBRA_HEADER_SIZE) { - flog_err(LIB_ERR_ZAPI_MISSMATCH, + flog_err(EC_LIB_ZAPI_MISSMATCH, "%s: socket %d message length %u is less than %d ", __func__, zclient->sock, length, ZEBRA_HEADER_SIZE); return zclient_failed(zclient); @@ -2415,7 +2415,7 @@ static int zclient_read(struct thread *thread) if (length > STREAM_SIZE(zclient->ibuf)) { struct stream *ns; flog_err( - LIB_ERR_ZAPI_ENCODE, + EC_LIB_ZAPI_ENCODE, "%s: message size %u exceeds buffer size %lu, expanding...", __func__, length, (unsigned long)STREAM_SIZE(zclient->ibuf)); |
