summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2022-12-05 11:50:12 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2022-12-05 11:50:12 +0000
commitde7a6a260b1624b5273766ea70b9b17afa9d6634 (patch)
tree4bd8f8c27a588c9a65dbb26e2050c6ef744bd9b2
parent29adffd60c4ff830062f0fc806be52c09160bc74 (diff)
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.
-rw-r--r--usr.sbin/bgpctl/ometric.c9
1 files 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 <claudio@openbsd.org>
@@ -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);
}
}