From a50404aaaee0f116e2a684df97a9d53d80cb0182 Mon Sep 17 00:00:00 2001 From: Rafael Zalamena Date: Mon, 10 Feb 2020 18:40:43 -0300 Subject: [PATCH] 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 --- zebra/dplane_fpm_nl.c | 18 ++++++++++-------- zebra/rt_netlink.c | 27 ++++++++++----------------- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/zebra/dplane_fpm_nl.c b/zebra/dplane_fpm_nl.c index 4b8948b71c..f035b3b1c6 100644 --- a/zebra/dplane_fpm_nl.c +++ b/zebra/dplane_fpm_nl.c @@ -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, "obuf-bytes", gfnc->counters.obuf_bytes); 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-errors", gfnc->counters.connection_errors); - json_object_int_add(jo, "data-plane-contexts", gfnc->counters.dplane_contexts); + json_object_int_add(jo, "connection-closes", + gfnc->counters.connection_closes); + 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", gfnc->counters.ctxqueue_len); json_object_int_add(jo, "data-plane-contexts-queue-peak", gfnc->counters.ctxqueue_len_peak); 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); vty_out(vty, "%s\n", json_object_to_json_string_ext(jo, 0)); 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)) { dest = rib_dest_from_rnode(rn); /* Skip bad route entries. */ - if (dest == NULL || dest->selected_fib == NULL) { + if (dest == NULL || dest->selected_fib == NULL) continue; - } /* Check for already sent routes. */ - if (CHECK_FLAG(dest->flags, RIB_DEST_UPDATE_FPM)) { + if (CHECK_FLAG(dest->flags, RIB_DEST_UPDATE_FPM)) continue; - } /* Enqueue route install. */ dplane_ctx_reset(ctx); diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 7ca4425dc8..c4af082e72 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -1290,7 +1290,6 @@ _netlink_route_build_multipath(const struct prefix *p, const char *routedesc, char label_buf[256]; int num_labels = 0; struct vrf *vrf; - char addrstr[INET6_ADDRSTRLEN]; rtnh->rtnh_len = sizeof(*rtnh); 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) *src = &nexthop->src; - if (IS_ZEBRA_DEBUG_KERNEL) { - inet_ntop(AF_INET, &nexthop->gate.ipv4, addrstr, - sizeof(addrstr)); - zlog_debug( "%s: (%s): %pFX nexthop via %s %s if %u vrf %s(%u)", - __func__, routedesc, p, addrstr, label_buf, - nexthop->ifindex, VRF_LOGNAME(vrf), - nexthop->vrf_id); - } + if (IS_ZEBRA_DEBUG_KERNEL) + zlog_debug("%s: (%s): %pFX nexthop via %pI4 %s if %u vrf %s(%u)", + __func__, routedesc, p, &nexthop->gate.ipv4, + label_buf, nexthop->ifindex, + VRF_LOGNAME(vrf), nexthop->vrf_id); } if (nexthop->type == NEXTHOP_TYPE_IPV6 || 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)) *src = &nexthop->src; - if (IS_ZEBRA_DEBUG_KERNEL) { - inet_ntop(AF_INET, &nexthop->gate.ipv6, addrstr, - sizeof(addrstr)); - zlog_debug( "%s: (%s): %pFX nexthop via %s %s if %u vrf %s(%u)", - __func__, routedesc, p, addrstr, label_buf, - nexthop->ifindex, VRF_LOGNAME(vrf), - nexthop->vrf_id); - } + if (IS_ZEBRA_DEBUG_KERNEL) + zlog_debug("%s: (%s): %pFX nexthop via %pI6 %s if %u vrf %s(%u)", + __func__, routedesc, p, &nexthop->gate.ipv6, + label_buf, nexthop->ifindex, + VRF_LOGNAME(vrf), nexthop->vrf_id); } /* -- 2.39.5