diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2022-07-07 12:17:58 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2022-07-07 12:17:58 +0000 |
commit | a29215f6e1fba496a55b4be6e4bd4b33f15dd6c4 (patch) | |
tree | cc2878648bf3058e8daad8da47e69708a9dbf0ac /usr.sbin/bgpctl | |
parent | 0aaf24dcf113c4bd55370067e8652a0f30fe8501 (diff) |
Print dmetric for prefixes, this may still change in the future.
OK tb@
Diffstat (limited to 'usr.sbin/bgpctl')
-rw-r--r-- | usr.sbin/bgpctl/bgpctl.c | 12 | ||||
-rw-r--r-- | usr.sbin/bgpctl/bgpctl.h | 2 | ||||
-rw-r--r-- | usr.sbin/bgpctl/output_json.c | 7 |
3 files changed, 17 insertions, 4 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c index f4857d17a98..d8ec76ad48d 100644 --- a/usr.sbin/bgpctl/bgpctl.c +++ b/usr.sbin/bgpctl/bgpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpctl.c,v 1.279 2022/06/27 13:27:38 claudio Exp $ */ +/* $OpenBSD: bgpctl.c,v 1.280 2022/07/07 12:17:57 claudio Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -675,7 +675,7 @@ fmt_origin(uint8_t origin, int sum) } const char * -fmt_flags(uint8_t flags, int sum) +fmt_flags(uint32_t flags, int sum) { static char buf[80]; char flagstr[5]; @@ -696,6 +696,10 @@ fmt_flags(uint8_t flags, int sum) *p++ = '*'; if (flags & F_PREF_BEST) *p++ = '>'; + if (flags & F_PREF_ECMP) + *p++ = 'm'; + if (flags & F_PREF_AS_WIDE) + *p++ = 'w'; *p = '\0'; snprintf(buf, sizeof(buf), "%-5s", flagstr); } else { @@ -714,6 +718,10 @@ fmt_flags(uint8_t flags, int sum) strlcat(buf, ", valid", sizeof(buf)); if (flags & F_PREF_BEST) strlcat(buf, ", best", sizeof(buf)); + if (flags & F_PREF_ECMP) + strlcat(buf, ", ecmp", sizeof(buf)); + if (flags & F_PREF_AS_WIDE) + strlcat(buf, ", as-wide", sizeof(buf)); if (flags & F_PREF_ANNOUNCE) strlcat(buf, ", announced", sizeof(buf)); if (strlen(buf) >= sizeof(buf) - 1) diff --git a/usr.sbin/bgpctl/bgpctl.h b/usr.sbin/bgpctl/bgpctl.h index 5486cc720c9..f147bedb2aa 100644 --- a/usr.sbin/bgpctl/bgpctl.h +++ b/usr.sbin/bgpctl/bgpctl.h @@ -47,7 +47,7 @@ const char *fmt_timeframe(time_t); const char *fmt_monotime(time_t); const char *fmt_fib_flags(uint16_t); const char *fmt_origin(uint8_t, int); -const char *fmt_flags(uint8_t, int); +const char *fmt_flags(uint32_t, int); const char *fmt_ovs(uint8_t, int); const char *fmt_auth_method(enum auth_method); const char *fmt_mem(long long); diff --git a/usr.sbin/bgpctl/output_json.c b/usr.sbin/bgpctl/output_json.c index 78ff0eb0c1c..7037dfd768b 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.17 2022/06/27 13:27:38 claudio Exp $ */ +/* $OpenBSD: output_json.c,v 1.18 2022/07/07 12:17:57 claudio Exp $ */ /* * Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org> @@ -870,6 +870,10 @@ json_rib(struct ctl_show_rib *r, u_char *asdata, size_t aslen, json_do_bool("valid", r->flags & F_PREF_ELIGIBLE); if (r->flags & F_PREF_BEST) json_do_bool("best", 1); + if (r->flags & F_PREF_ECMP) + json_do_bool("ecmp", 1); + if (r->flags & F_PREF_AS_WIDE) + json_do_bool("as-wide", 1); if (r->flags & F_PREF_INTERNAL) json_do_printf("source", "%s", "internal"); else @@ -885,6 +889,7 @@ json_rib(struct ctl_show_rib *r, u_char *asdata, size_t aslen, json_do_uint("metric", r->med); json_do_uint("localpref", r->local_pref); json_do_uint("weight", r->weight); + json_do_int("dmetric", r->dmetric); json_do_printf("last_update", "%s", fmt_timeframe(r->age)); json_do_int("last_update_sec", r->age); |