From d935d7a8ad3bdd0dec9b162c2b7a7404e4c5be88 Mon Sep 17 00:00:00 2001 From: claudio Date: Mon, 5 Dec 2022 11:50:11 +0000 Subject: [PATCH] Revert and adjust the changes in ometric_set_state() from last commit. Calling ometric_set_int_with_labels() for a state metric fails because there is a check in ometric_set_int comparing the type. Use olabels_add_extras() and ometric_set_int_value() instead. --- usr.sbin/bgpctl/ometric.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/usr.sbin/bgpctl/ometric.c b/usr.sbin/bgpctl/ometric.c index 37abc64fd0f..296c08026d3 100644 --- a/usr.sbin/bgpctl/ometric.c +++ b/usr.sbin/bgpctl/ometric.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ometric.c,v 1.4 2022/12/01 09:14:40 claudio Exp $ */ +/* $OpenBSD: ometric.c,v 1.5 2022/12/05 11:50:11 claudio Exp $ */ /* * Copyright (c) 2022 Claudio Jeker @@ -390,6 +390,7 @@ ometric_set_info(struct ometric *om, const char **keys, const char **values, void ometric_set_state(struct ometric *om, const char *state, struct olabels *ol) { + struct olabels *extra; size_t i; int val; @@ -402,8 +403,10 @@ ometric_set_state(struct ometric *om, const char *state, struct olabels *ol) else val = 0; - ometric_set_int_with_labels(om, val, OKV(om->name), - OKV(om->stateset[i]), ol); + extra = olabels_add_extras(ol, OKV(om->name), + OKV(om->stateset[i])); + ometric_set_int_value(om, val, extra); + olabels_free(extra); } } -- 2.20.1