zebra: fix some formatting/style issues

* Break lines longer than 80 columns.
* Remove space after '('.
* Use '%pIX' instead of 'inet_ntop'.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This commit is contained in:
Rafael Zalamena 2020-02-10 18:40:43 -03:00
parent f2a0ba3a50
commit a50404aaae
2 changed files with 20 additions and 25 deletions

View File

@ -308,15 +308,19 @@ DEFUN(fpm_show_counters_json, fpm_show_counters_json_cmd,
json_object_int_add(jo, "bytes-sent", gfnc->counters.bytes_sent); json_object_int_add(jo, "bytes-sent", gfnc->counters.bytes_sent);
json_object_int_add(jo, "obuf-bytes", gfnc->counters.obuf_bytes); json_object_int_add(jo, "obuf-bytes", gfnc->counters.obuf_bytes);
json_object_int_add(jo, "obuf-bytes-peak", gfnc->counters.obuf_peak); json_object_int_add(jo, "obuf-bytes-peak", gfnc->counters.obuf_peak);
json_object_int_add(jo, "connection-closes", gfnc->counters.connection_closes); json_object_int_add(jo, "connection-closes",
json_object_int_add(jo, "connection-errors", gfnc->counters.connection_errors); gfnc->counters.connection_closes);
json_object_int_add(jo, "data-plane-contexts", gfnc->counters.dplane_contexts); json_object_int_add(jo, "connection-errors",
gfnc->counters.connection_errors);
json_object_int_add(jo, "data-plane-contexts",
gfnc->counters.dplane_contexts);
json_object_int_add(jo, "data-plane-contexts-queue", json_object_int_add(jo, "data-plane-contexts-queue",
gfnc->counters.ctxqueue_len); gfnc->counters.ctxqueue_len);
json_object_int_add(jo, "data-plane-contexts-queue-peak", json_object_int_add(jo, "data-plane-contexts-queue-peak",
gfnc->counters.ctxqueue_len_peak); gfnc->counters.ctxqueue_len_peak);
json_object_int_add(jo, "buffer-full-hits", gfnc->counters.buffer_full); json_object_int_add(jo, "buffer-full-hits", gfnc->counters.buffer_full);
json_object_int_add(jo, "user-configures", gfnc->counters.user_configures); json_object_int_add(jo, "user-configures",
gfnc->counters.user_configures);
json_object_int_add(jo, "user-disables", gfnc->counters.user_disables); json_object_int_add(jo, "user-disables", gfnc->counters.user_disables);
vty_out(vty, "%s\n", json_object_to_json_string_ext(jo, 0)); vty_out(vty, "%s\n", json_object_to_json_string_ext(jo, 0));
json_object_free(jo); json_object_free(jo);
@ -762,14 +766,12 @@ static int fpm_rib_send(struct thread *t)
for (rn = route_top(rt); rn; rn = srcdest_route_next(rn)) { for (rn = route_top(rt); rn; rn = srcdest_route_next(rn)) {
dest = rib_dest_from_rnode(rn); dest = rib_dest_from_rnode(rn);
/* Skip bad route entries. */ /* Skip bad route entries. */
if (dest == NULL || dest->selected_fib == NULL) { if (dest == NULL || dest->selected_fib == NULL)
continue; continue;
}
/* Check for already sent routes. */ /* Check for already sent routes. */
if (CHECK_FLAG(dest->flags, RIB_DEST_UPDATE_FPM)) { if (CHECK_FLAG(dest->flags, RIB_DEST_UPDATE_FPM))
continue; continue;
}
/* Enqueue route install. */ /* Enqueue route install. */
dplane_ctx_reset(ctx); dplane_ctx_reset(ctx);

View File

@ -1290,7 +1290,6 @@ _netlink_route_build_multipath(const struct prefix *p, const char *routedesc,
char label_buf[256]; char label_buf[256];
int num_labels = 0; int num_labels = 0;
struct vrf *vrf; struct vrf *vrf;
char addrstr[INET6_ADDRSTRLEN];
rtnh->rtnh_len = sizeof(*rtnh); rtnh->rtnh_len = sizeof(*rtnh);
rtnh->rtnh_flags = 0; rtnh->rtnh_flags = 0;
@ -1377,14 +1376,11 @@ _netlink_route_build_multipath(const struct prefix *p, const char *routedesc,
else if (nexthop->src.ipv4.s_addr != INADDR_ANY) else if (nexthop->src.ipv4.s_addr != INADDR_ANY)
*src = &nexthop->src; *src = &nexthop->src;
if (IS_ZEBRA_DEBUG_KERNEL) { if (IS_ZEBRA_DEBUG_KERNEL)
inet_ntop(AF_INET, &nexthop->gate.ipv4, addrstr, zlog_debug("%s: (%s): %pFX nexthop via %pI4 %s if %u vrf %s(%u)",
sizeof(addrstr)); __func__, routedesc, p, &nexthop->gate.ipv4,
zlog_debug( "%s: (%s): %pFX nexthop via %s %s if %u vrf %s(%u)", label_buf, nexthop->ifindex,
__func__, routedesc, p, addrstr, label_buf, VRF_LOGNAME(vrf), nexthop->vrf_id);
nexthop->ifindex, VRF_LOGNAME(vrf),
nexthop->vrf_id);
}
} }
if (nexthop->type == NEXTHOP_TYPE_IPV6 if (nexthop->type == NEXTHOP_TYPE_IPV6
|| nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX) { || nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX) {
@ -1397,14 +1393,11 @@ _netlink_route_build_multipath(const struct prefix *p, const char *routedesc,
else if (!IN6_IS_ADDR_UNSPECIFIED(&nexthop->src.ipv6)) else if (!IN6_IS_ADDR_UNSPECIFIED(&nexthop->src.ipv6))
*src = &nexthop->src; *src = &nexthop->src;
if (IS_ZEBRA_DEBUG_KERNEL) { if (IS_ZEBRA_DEBUG_KERNEL)
inet_ntop(AF_INET, &nexthop->gate.ipv6, addrstr, zlog_debug("%s: (%s): %pFX nexthop via %pI6 %s if %u vrf %s(%u)",
sizeof(addrstr)); __func__, routedesc, p, &nexthop->gate.ipv6,
zlog_debug( "%s: (%s): %pFX nexthop via %s %s if %u vrf %s(%u)", label_buf, nexthop->ifindex,
__func__, routedesc, p, addrstr, label_buf, VRF_LOGNAME(vrf), nexthop->vrf_id);
nexthop->ifindex, VRF_LOGNAME(vrf),
nexthop->vrf_id);
}
} }
/* /*