From c4f772fdd90bc7e9be47c4424d8cf279d7f194a9 Mon Sep 17 00:00:00 2001 From: claudio Date: Tue, 17 Jan 2023 16:09:34 +0000 Subject: [PATCH] Teach bgpctl about ASPA tables. OK tb@ --- usr.sbin/bgpctl/bgpctl.c | 4 +++- usr.sbin/bgpctl/output.c | 4 ++-- usr.sbin/bgpctl/output_json.c | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c index 189e518b38d..a221e215c42 100644 --- a/usr.sbin/bgpctl/bgpctl.c +++ b/usr.sbin/bgpctl/bgpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpctl.c,v 1.287 2022/10/18 09:30:29 job Exp $ */ +/* $OpenBSD: bgpctl.c,v 1.288 2023/01/17 16:09:34 claudio Exp $ */ /* * Copyright (c) 2003 Henning Brauer @@ -1062,6 +1062,8 @@ const char * fmt_set_type(struct ctl_show_set *set) { switch (set->type) { + case ASPA_SET: + return "ASPA"; case ROA_SET: return "ROA"; case PREFIX_SET: diff --git a/usr.sbin/bgpctl/output.c b/usr.sbin/bgpctl/output.c index 1597d48be81..6c0b4b397eb 100644 --- a/usr.sbin/bgpctl/output.c +++ b/usr.sbin/bgpctl/output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output.c,v 1.32 2022/11/09 14:20:11 claudio Exp $ */ +/* $OpenBSD: output.c,v 1.33 2023/01/17 16:09:34 claudio Exp $ */ /* * Copyright (c) 2003 Henning Brauer @@ -1039,7 +1039,7 @@ show_rib_set(struct ctl_show_set *set) { char buf[64]; - if (set->type == ASNUM_SET) + if (set->type == ASNUM_SET || set->type == ASPA_SET) snprintf(buf, sizeof(buf), "%7s %7s %6zu", "-", "-", set->as_cnt); else diff --git a/usr.sbin/bgpctl/output_json.c b/usr.sbin/bgpctl/output_json.c index 008d2f3e462..115b1d36636 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.27 2022/12/28 21:30:15 jmc Exp $ */ +/* $OpenBSD: output_json.c,v 1.28 2023/01/17 16:09:34 claudio Exp $ */ /* * Copyright (c) 2020 Claudio Jeker @@ -981,7 +981,7 @@ json_rib_set(struct ctl_show_set *set) json_do_printf("type", "%s", fmt_set_type(set)); json_do_printf("last_change", "%s", fmt_monotime(set->lastchange)); json_do_int("last_change_sec", get_monotime(set->lastchange)); - if (set->type == ASNUM_SET) { + if (set->type == ASNUM_SET || set->type == ASPA_SET) { json_do_uint("num_ASnum", set->as_cnt); } else { json_do_uint("num_IPv4", set->v4_cnt); -- 2.20.1