forked from Mirror/frr
lib, zebra: fix formatting and style
Signed-off-by: Fredi Raspall <fredi@voltanet.io>
This commit is contained in:
parent
aec865e416
commit
0313523d77
|
@ -1231,8 +1231,7 @@ stream_failure:
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void zapi_encode_prefix(struct stream *s,
|
||||
struct prefix *p,
|
||||
static void zapi_encode_prefix(struct stream *s, struct prefix *p,
|
||||
uint8_t family)
|
||||
{
|
||||
struct prefix any;
|
||||
|
@ -1248,8 +1247,7 @@ static void zapi_encode_prefix(struct stream *s,
|
|||
stream_put(s, &p->u.prefix, prefix_blen(p));
|
||||
}
|
||||
|
||||
int zapi_pbr_rule_encode(uint8_t cmd, struct stream *s,
|
||||
struct pbr_rule *zrule)
|
||||
int zapi_pbr_rule_encode(uint8_t cmd, struct stream *s, struct pbr_rule *zrule)
|
||||
{
|
||||
stream_reset(s);
|
||||
zclient_create_header(s, cmd, zrule->vrf_id);
|
||||
|
@ -1317,8 +1315,8 @@ bool zapi_rule_notify_decode(struct stream *s, uint32_t *seqno,
|
|||
STREAM_GETL(s, ifi);
|
||||
|
||||
if (zclient_debug)
|
||||
zlog_debug("%s: %u %u %u %u", __PRETTY_FUNCTION__,
|
||||
seq, prio, uni, ifi);
|
||||
zlog_debug("%s: %u %u %u %u", __PRETTY_FUNCTION__, seq, prio,
|
||||
uni, ifi);
|
||||
*seqno = seq;
|
||||
*priority = prio;
|
||||
*unique = uni;
|
||||
|
@ -1330,8 +1328,7 @@ stream_failure:
|
|||
return false;
|
||||
}
|
||||
|
||||
bool zapi_ipset_notify_decode(struct stream *s,
|
||||
uint32_t *unique,
|
||||
bool zapi_ipset_notify_decode(struct stream *s, uint32_t *unique,
|
||||
enum zapi_ipset_notify_owner *note)
|
||||
{
|
||||
uint32_t uni;
|
||||
|
@ -1350,8 +1347,7 @@ stream_failure:
|
|||
return false;
|
||||
}
|
||||
|
||||
bool zapi_ipset_entry_notify_decode(struct stream *s,
|
||||
uint32_t *unique,
|
||||
bool zapi_ipset_entry_notify_decode(struct stream *s, uint32_t *unique,
|
||||
char *ipset_name,
|
||||
enum zapi_ipset_entry_notify_owner *note)
|
||||
{
|
||||
|
@ -1361,8 +1357,7 @@ bool zapi_ipset_entry_notify_decode(struct stream *s,
|
|||
|
||||
STREAM_GETL(s, uni);
|
||||
|
||||
STREAM_GET(ipset_name, s,
|
||||
ZEBRA_IPSET_NAME_SIZE);
|
||||
STREAM_GET(ipset_name, s, ZEBRA_IPSET_NAME_SIZE);
|
||||
|
||||
if (zclient_debug)
|
||||
zlog_debug("%s: %u", __PRETTY_FUNCTION__, uni);
|
||||
|
@ -1872,7 +1867,8 @@ struct connected *zebra_interface_address_read(int type, struct stream *s,
|
|||
zlog_warn(
|
||||
"warning: interface %s address %s "
|
||||
"with peer flag set, but no peer address!",
|
||||
ifp->name, prefix2str(ifc->address, buf,
|
||||
ifp->name,
|
||||
prefix2str(ifc->address, buf,
|
||||
sizeof buf));
|
||||
UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER);
|
||||
}
|
||||
|
@ -2086,17 +2082,18 @@ int lm_label_manager_connect(struct zclient *zclient)
|
|||
|
||||
/* sanity */
|
||||
if (proto != zclient->redist_default)
|
||||
zlog_err("Wrong proto (%u) in LM connect response. Should be %u",
|
||||
zlog_err(
|
||||
"Wrong proto (%u) in LM connect response. Should be %u",
|
||||
proto, zclient->redist_default);
|
||||
if (instance != zclient->instance)
|
||||
zlog_err("Wrong instId (%u) in LM connect response. Should be %u",
|
||||
zlog_err(
|
||||
"Wrong instId (%u) in LM connect response. Should be %u",
|
||||
instance, zclient->instance);
|
||||
|
||||
/* result code */
|
||||
result = stream_getc(s);
|
||||
if (zclient_debug)
|
||||
zlog_debug(
|
||||
"LM connect-response received, result %u", result);
|
||||
zlog_debug("LM connect-response received, result %u", result);
|
||||
|
||||
return (int)result;
|
||||
}
|
||||
|
@ -2109,9 +2106,7 @@ int lm_label_manager_connect(struct zclient *zclient)
|
|||
* @param chunk_size Amount of labels requested
|
||||
* @result 0 on success, -1 otherwise
|
||||
*/
|
||||
int zclient_send_get_label_chunk(
|
||||
struct zclient *zclient,
|
||||
uint8_t keep,
|
||||
int zclient_send_get_label_chunk(struct zclient *zclient, uint8_t keep,
|
||||
uint32_t chunk_size)
|
||||
{
|
||||
struct stream *s;
|
||||
|
@ -2334,8 +2329,7 @@ int tm_table_manager_connect(struct zclient *zclient)
|
|||
return -1;
|
||||
|
||||
if (zclient_debug)
|
||||
zlog_debug("%s: Table manager connect request sent",
|
||||
__func__);
|
||||
zlog_debug("%s: Table manager connect request sent", __func__);
|
||||
|
||||
/* read response */
|
||||
if (zclient_read_sync_response(zclient, ZEBRA_TABLE_MANAGER_CONNECT)
|
||||
|
|
|
@ -82,8 +82,8 @@ static int relay_response_back(void)
|
|||
ret = zclient_read_header(src, zclient->sock, &size, &marker, &version,
|
||||
&vrf_id, &resp_cmd);
|
||||
if (ret < 0 && errno != EAGAIN) {
|
||||
zlog_err("%s: Error reading Label Manager response: %s",
|
||||
__func__, strerror(errno));
|
||||
zlog_err("Error reading Label Manager response: %s",
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
zlog_debug("Label Manager response received, %d bytes", size);
|
||||
|
@ -101,7 +101,8 @@ static int relay_response_back(void)
|
|||
/* lookup the client to relay the msg to */
|
||||
zserv = zebra_find_client(proto, instance);
|
||||
if (!zserv) {
|
||||
zlog_err("Error relaying LM response: can't find client %s, instance %u",
|
||||
zlog_err(
|
||||
"Error relaying LM response: can't find client %s, instance %u",
|
||||
proto_str, instance);
|
||||
return -1;
|
||||
}
|
||||
|
@ -119,8 +120,8 @@ static int relay_response_back(void)
|
|||
proto_str, instance, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
zlog_debug("Relayed LM response (%d bytes) to %s instance %u",
|
||||
ret, proto_str, instance);
|
||||
zlog_debug("Relayed LM response (%d bytes) to %s instance %u", ret,
|
||||
proto_str, instance);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -203,8 +204,8 @@ int zread_relay_label_manager_request(int cmd, struct zserv *zserv,
|
|||
|
||||
/* check & set client proto if unset */
|
||||
if (zserv->proto && zserv->proto != proto) {
|
||||
zlog_warn("Client proto(%u) != msg proto(%u)",
|
||||
zserv->proto, proto);
|
||||
zlog_warn("Client proto(%u) != msg proto(%u)", zserv->proto,
|
||||
proto);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -237,8 +238,8 @@ int zread_relay_label_manager_request(int cmd, struct zserv *zserv,
|
|||
reply_error(cmd, zserv, vrf_id);
|
||||
return -1;
|
||||
}
|
||||
zlog_debug("Relayed LM request (%d bytes) from %s instance %u",
|
||||
ret, proto_str, instance);
|
||||
zlog_debug("Relayed LM request (%d bytes) from %s instance %u", ret,
|
||||
proto_str, instance);
|
||||
|
||||
|
||||
/* Release label chunk has no response */
|
||||
|
|
|
@ -2419,7 +2419,8 @@ static int msg_client_id_mismatch(const char *op, struct zserv *client,
|
|||
}
|
||||
|
||||
if (instance != client->instance) {
|
||||
zlog_err("%s: msg vs client instance mismatch, client=%u msg=%u",
|
||||
zlog_err(
|
||||
"%s: msg vs client instance mismatch, client=%u msg=%u",
|
||||
op, client->instance, instance);
|
||||
/* TODO: fail when BGP sets proto and instance */
|
||||
/* return 1; */
|
||||
|
@ -2453,11 +2454,14 @@ static void zread_get_label_chunk(struct zserv *client, struct stream *msg,
|
|||
|
||||
lmc = assign_label_chunk(client->proto, client->instance, keep, size);
|
||||
if (!lmc)
|
||||
zlog_err("Unable to assign Label Chunk of size %u to %s instance %u",
|
||||
size, zebra_route_string(client->proto), client->instance);
|
||||
zlog_err(
|
||||
"Unable to assign Label Chunk of size %u to %s instance %u",
|
||||
size, zebra_route_string(client->proto),
|
||||
client->instance);
|
||||
else
|
||||
zlog_debug("Assigned Label Chunk %u - %u to %s instance %u", lmc->start,
|
||||
lmc->end, zebra_route_string(client->proto), client->instance);
|
||||
zlog_debug("Assigned Label Chunk %u - %u to %s instance %u",
|
||||
lmc->start, lmc->end,
|
||||
zebra_route_string(client->proto), client->instance);
|
||||
/* send response back */
|
||||
zsend_assign_label_chunk_response(client, vrf_id, lmc);
|
||||
|
||||
|
@ -2482,7 +2486,8 @@ static void zread_release_label_chunk(struct zserv *client, struct stream *msg)
|
|||
STREAM_GETL(s, end);
|
||||
|
||||
/* detect client vs message (proto,instance) mismatch */
|
||||
if (msg_client_id_mismatch("Release-label-chunk", client, proto, instance))
|
||||
if (msg_client_id_mismatch("Release-label-chunk", client, proto,
|
||||
instance))
|
||||
return;
|
||||
|
||||
release_label_chunk(client->proto, client->instance, start, end);
|
||||
|
@ -2498,8 +2503,8 @@ static void zread_label_manager_request(ZAPI_HANDLER_ARGS)
|
|||
|
||||
/* external label manager */
|
||||
if (lm_is_external)
|
||||
zread_relay_label_manager_request(hdr->command, client,
|
||||
msg, zvrf_id(zvrf));
|
||||
zread_relay_label_manager_request(hdr->command, client, msg,
|
||||
zvrf_id(zvrf));
|
||||
/* this is a label manager */
|
||||
else {
|
||||
if (hdr->command == ZEBRA_LABEL_MANAGER_CONNECT)
|
||||
|
|
Loading…
Reference in a new issue