From ae328b7f3d322b17fe9883ce5b094b19772cf34e Mon Sep 17 00:00:00 2001 From: claudio Date: Mon, 20 Nov 2023 14:18:21 +0000 Subject: [PATCH] KNF --- usr.sbin/bgpctl/mrtparser.c | 4 ++-- usr.sbin/bgpctl/output.c | 8 ++++---- usr.sbin/bgpctl/output_json.c | 8 ++++---- usr.sbin/bgpctl/output_ometric.c | 6 +++--- usr.sbin/bgpctl/parser.c | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/usr.sbin/bgpctl/mrtparser.c b/usr.sbin/bgpctl/mrtparser.c index 77fb54c614a..39b101c141d 100644 --- a/usr.sbin/bgpctl/mrtparser.c +++ b/usr.sbin/bgpctl/mrtparser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mrtparser.c,v 1.19 2022/10/18 09:30:29 job Exp $ */ +/* $OpenBSD: mrtparser.c,v 1.20 2023/11/20 14:18:21 claudio Exp $ */ /* * Copyright (c) 2011 Claudio Jeker * @@ -435,7 +435,7 @@ mrt_parse_v2_rib(struct mrt_hdr *hdr, void *msg, int verbose) if ((aid = mrt_afi2aid(afi, safi, verbose)) == AID_UNSPEC) goto fail; - + /* prefix */ ret = mrt_extract_prefix(b, len, aid, &r->prefix, &r->prefixlen, verbose); diff --git a/usr.sbin/bgpctl/output.c b/usr.sbin/bgpctl/output.c index d50a62c7dae..d9a5e52793c 100644 --- a/usr.sbin/bgpctl/output.c +++ b/usr.sbin/bgpctl/output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output.c,v 1.41 2023/04/28 13:24:25 claudio Exp $ */ +/* $OpenBSD: output.c,v 1.42 2023/11/20 14:18:21 claudio Exp $ */ /* * Copyright (c) 2003 Henning Brauer @@ -1176,21 +1176,21 @@ show_rtr(struct ctl_show_rtr *rtr) if (rtr->local_addr.aid != AID_UNSPEC) printf(" Local Address: %s\n", log_addr(&rtr->local_addr)); if (rtr->session_id != -1) - printf (" Session ID: %d Serial #: %u\n", + printf(" Session ID: %d Serial #: %u\n", rtr->session_id, rtr->serial); printf(" Refresh: %u, Retry: %u, Expire: %u\n", rtr->refresh, rtr->retry, rtr->expire); if (rtr->last_sent_error != NO_ERROR) { printf(" Last sent error: %s\n", - log_rtr_error(rtr->last_sent_error)); + log_rtr_error(rtr->last_sent_error)); if (rtr->last_sent_msg[0]) printf(" with reason \"%s\"", log_reason(rtr->last_sent_msg)); } if (rtr->last_recv_error != NO_ERROR) { printf(" Last received error: %s\n", - log_rtr_error(rtr->last_recv_error)); + log_rtr_error(rtr->last_recv_error)); if (rtr->last_recv_msg[0]) printf(" with reason \"%s\"", log_reason(rtr->last_recv_msg)); diff --git a/usr.sbin/bgpctl/output_json.c b/usr.sbin/bgpctl/output_json.c index 40b48c017f1..cf0a476fe0b 100644 --- a/usr.sbin/bgpctl/output_json.c +++ b/usr.sbin/bgpctl/output_json.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output_json.c,v 1.35 2023/06/05 16:24:05 claudio Exp $ */ +/* $OpenBSD: output_json.c,v 1.36 2023/11/20 14:18:21 claudio Exp $ */ /* * Copyright (c) 2020 Claudio Jeker @@ -392,7 +392,7 @@ json_fib(struct kroute_full *kf) if (kf->flags & F_MPLS) { json_do_array("mplslabel"); - json_do_uint("mplslabel", + json_do_uint("mplslabel", ntohl(kf->mplslabel) >> MPLS_LABEL_OFFSET); json_do_end(); } @@ -956,7 +956,7 @@ json_rib_mem(struct rde_memstats *stats) stats->attr_cnt * sizeof(struct attr), stats->attr_refs); json_rib_mem_element("attributes", stats->attr_dcnt, stats->attr_data, UINT64_MAX); - json_rib_mem_element("total", UINT64_MAX, + json_rib_mem_element("total", UINT64_MAX, pts + stats->prefix_cnt * sizeof(struct prefix) + stats->rib_cnt * sizeof(struct rib_entry) + stats->path_cnt * sizeof(struct rde_aspath) + @@ -971,7 +971,7 @@ json_rib_mem(struct rde_memstats *stats) UINT64_MAX); json_rib_mem_element("prefix_set", stats->pset_cnt, stats->pset_size, UINT64_MAX); - json_rib_mem_element("total", UINT64_MAX, + json_rib_mem_element("total", UINT64_MAX, stats->aset_size + stats->pset_size, UINT64_MAX); json_do_end(); } diff --git a/usr.sbin/bgpctl/output_ometric.c b/usr.sbin/bgpctl/output_ometric.c index 2b0b9be6cb2..69f9494e6ff 100644 --- a/usr.sbin/bgpctl/output_ometric.c +++ b/usr.sbin/bgpctl/output_ometric.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output_ometric.c,v 1.11 2023/03/28 12:07:09 claudio Exp $ */ +/* $OpenBSD: output_ometric.c,v 1.12 2023/11/20 14:18:21 claudio Exp $ */ /* * Copyright (c) 2022 Claudio Jeker @@ -297,7 +297,7 @@ ometric_rib_mem(struct rde_memstats *stats) ometric_rib_mem_element("attributes", stats->attr_dcnt, stats->attr_data, UINT64_MAX); - ometric_rib_mem_element("total", UINT64_MAX, + ometric_rib_mem_element("total", UINT64_MAX, pts + stats->prefix_cnt * sizeof(struct prefix) + stats->rib_cnt * sizeof(struct rib_entry) + stats->path_cnt * sizeof(struct rde_aspath) + @@ -314,7 +314,7 @@ ometric_rib_mem(struct rde_memstats *stats) OKV("type"), OKV("prefix_set"), NULL); ometric_set_int_with_labels(rde_set_count, stats->pset_cnt, OKV("type"), OKV("prefix_set"), NULL); - ometric_rib_mem_element("set_total", UINT64_MAX, + ometric_rib_mem_element("set_total", UINT64_MAX, stats->aset_size + stats->pset_size, UINT64_MAX); } diff --git a/usr.sbin/bgpctl/parser.c b/usr.sbin/bgpctl/parser.c index ae9003fd7b7..56be82df705 100644 --- a/usr.sbin/bgpctl/parser.c +++ b/usr.sbin/bgpctl/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.133 2023/05/09 13:26:27 claudio Exp $ */ +/* $OpenBSD: parser.c,v 1.134 2023/11/20 14:18:21 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -329,8 +329,8 @@ static const struct token t_show_mrt_as[] = { static const struct token t_show_prefix[] = { { FLAG, "all", F_LONGER, t_show_rib}, { FLAG, "longer-prefixes", F_LONGER, t_show_rib}, - { FLAG, "or-longer", F_LONGER, t_show_rib}, - { FLAG, "or-shorter", F_SHORTER, t_show_rib}, + { FLAG, "or-longer", F_LONGER, t_show_rib}, + { FLAG, "or-shorter", F_SHORTER, t_show_rib}, { ANYTOKEN, "", NONE, t_show_rib}, { ENDTOKEN, "", NONE, NULL} }; -- 2.20.1