summaryrefslogtreecommitdiff
path: root/lib/zclient.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2018-09-13 19:38:57 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2018-09-13 19:38:57 +0000
commit1c50c1c0d683ebfa53c1607c71b8d26547e8f218 (patch)
tree0dbb03af253cdcb0abeacaf6a860a4c7600359c5 /lib/zclient.c
parent450971aa994e68f7c62c4d45065223d5cfc4a22f (diff)
*: style for EC replacements
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/zclient.c')
-rw-r--r--lib/zclient.c96
1 files changed, 49 insertions, 47 deletions
diff --git a/lib/zclient.c b/lib/zclient.c
index 56c47d2b19..1cdf4ff22e 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -315,9 +315,10 @@ 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(EC_LIB_ZAPI_MISSMATCH,
- "%s: socket %d version mismatch, marker %d, version %d",
- __func__, sock, *marker, *version);
+ flog_err(
+ EC_LIB_ZAPI_MISSMATCH,
+ "%s: socket %d version mismatch, marker %d, version %d",
+ __func__, sock, *marker, *version);
return -1;
}
@@ -819,11 +820,11 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api)
prefix2str(&api->prefix, buf,
sizeof(buf));
flog_err(EC_LIB_ZAPI_ENCODE,
- "%s: prefix %s: can't encode "
- "%u labels (maximum is %u)",
- __func__, buf,
- api_nh->label_num,
- MPLS_MAX_LABELS);
+ "%s: prefix %s: can't encode "
+ "%u labels (maximum is %u)",
+ __func__, buf,
+ api_nh->label_num,
+ MPLS_MAX_LABELS);
return -1;
}
@@ -1451,10 +1452,11 @@ 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(EC_LIB_ZAPI_MISSMATCH,
- "%s: received %d > %d (MAX_CLASS_TYPE) bw entries"
- " - outdated library?",
- __func__, bwclassnum, MAX_CLASS_TYPE);
+ flog_err(
+ EC_LIB_ZAPI_MISSMATCH,
+ "%s: received %d > %d (MAX_CLASS_TYPE) bw entries"
+ " - outdated library?",
+ __func__, bwclassnum, MAX_CLASS_TYPE);
}
iflp->admin_grp = stream_getl(s);
iflp->rmt_as = stream_getl(s);
@@ -1484,8 +1486,8 @@ struct interface *zebra_interface_link_params_read(struct stream *s)
if (ifp == NULL) {
flog_err(EC_LIB_ZAPI_ENCODE,
- "%s: unknown ifindex %u, shouldn't happen", __func__,
- ifindex);
+ "%s: unknown ifindex %u, shouldn't happen", __func__,
+ ifindex);
return NULL;
}
@@ -1823,8 +1825,8 @@ static int zclient_read_sync_response(struct zclient *zclient,
size);
}
if (ret != 0) {
- flog_err(EC_LIB_ZAPI_ENCODE,
- "%s: Invalid Sync Message Reply", __func__);
+ flog_err(EC_LIB_ZAPI_ENCODE, "%s: Invalid Sync Message Reply",
+ __func__);
return -1;
}
@@ -1893,13 +1895,15 @@ int lm_label_manager_connect(struct zclient *zclient)
/* sanity */
if (proto != zclient->redist_default)
- flog_err(EC_LIB_ZAPI_ENCODE,
- "Wrong proto (%u) in LM connect response. Should be %u",
- proto, zclient->redist_default);
+ 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(EC_LIB_ZAPI_ENCODE,
- "Wrong instId (%u) in LM connect response. Should be %u",
- instance, zclient->instance);
+ flog_err(
+ EC_LIB_ZAPI_ENCODE,
+ "Wrong instId (%u) in LM connect response. Should be %u",
+ instance, zclient->instance);
/* result code */
result = stream_getc(s);
@@ -1988,15 +1992,13 @@ 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(EC_LIB_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(EC_LIB_ZAPI_SOCKET,
- "Zclient sock closed");
+ flog_err(EC_LIB_ZAPI_SOCKET, "Zclient sock closed");
close(zclient->sock);
zclient->sock = -1;
return -1;
@@ -2018,12 +2020,12 @@ int lm_get_label_chunk(struct zclient *zclient, uint8_t keep,
/* sanities */
if (proto != zclient->redist_default)
flog_err(EC_LIB_ZAPI_ENCODE,
- "Wrong proto (%u) in get chunk response. Should be %u",
- proto, zclient->redist_default);
+ "Wrong proto (%u) in get chunk response. Should be %u",
+ proto, zclient->redist_default);
if (instance != zclient->instance)
flog_err(EC_LIB_ZAPI_ENCODE,
- "Wrong instId (%u) in get chunk response Should be %u",
- instance, zclient->instance);
+ "Wrong instId (%u) in get chunk response Should be %u",
+ instance, zclient->instance);
/* keep */
response_keep = stream_getc(s);
@@ -2033,15 +2035,16 @@ int lm_get_label_chunk(struct zclient *zclient, uint8_t keep,
/* not owning this response */
if (keep != response_keep) {
- flog_err(EC_LIB_ZAPI_ENCODE,
- "Invalid Label chunk: %u - %u, keeps mismatch %u != %u",
- *start, *end, keep, response_keep);
+ 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(EC_LIB_ZAPI_ENCODE,
- "Invalid Label chunk: %u - %u", *start, *end);
+ flog_err(EC_LIB_ZAPI_ENCODE, "Invalid Label chunk: %u - %u",
+ *start, *end);
return -1;
}
@@ -2097,8 +2100,7 @@ int lm_release_label_chunk(struct zclient *zclient, uint32_t start,
return -1;
}
if (ret == 0) {
- flog_err(EC_LIB_ZAPI_SOCKET,
- "Zclient sock connection closed");
+ flog_err(EC_LIB_ZAPI_SOCKET, "Zclient sock connection closed");
close(zclient->sock);
zclient->sock = -1;
return -1;
@@ -2201,15 +2203,15 @@ 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(EC_LIB_ZAPI_SOCKET,
- "%s: can't write to zclient->sock", __func__);
+ 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(EC_LIB_ZAPI_SOCKET,
- "%s: zclient->sock connection closed", __func__);
+ "%s: zclient->sock connection closed", __func__);
close(zclient->sock);
zclient->sock = -1;
return -1;
@@ -2295,8 +2297,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(EC_LIB_ZAPI_ENCODE,
- "%s: unknown af", __func__);
+ flog_err(EC_LIB_ZAPI_ENCODE, "%s: unknown af", __func__);
return -1;
}
@@ -2398,16 +2399,17 @@ static int zclient_read(struct thread *thread)
command = stream_getw(zclient->ibuf);
if (marker != ZEBRA_HEADER_MARKER || version != ZSERV_VERSION) {
- flog_err(EC_LIB_ZAPI_MISSMATCH,
- "%s: socket %d version mismatch, marker %d, version %d",
- __func__, zclient->sock, marker, version);
+ 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(EC_LIB_ZAPI_MISSMATCH,
- "%s: socket %d message length %u is less than %d ",
- __func__, zclient->sock, length, ZEBRA_HEADER_SIZE);
+ "%s: socket %d message length %u is less than %d ",
+ __func__, zclient->sock, length, ZEBRA_HEADER_SIZE);
return zclient_failed(zclient);
}