diff options
author | 2020-08-08 13:02:54 +0000 | |
---|---|---|
committer | 2020-08-08 13:02:54 +0000 | |
commit | 6972fbe41834b480a4c665bc181be6dc801b07ad (patch) | |
tree | 2029fb11ba9a89c361416e2b0fda505a3bc0225e | |
parent | The only thing worse than trailing whitespace is leading spaces instead of tabs. (diff) | |
download | wireguard-openbsd-6972fbe41834b480a4c665bc181be6dc801b07ad.tar.xz wireguard-openbsd-6972fbe41834b480a4c665bc181be6dc801b07ad.zip |
Clean up smi_mibtree.
It checks on o_oid[0] for 0, which prevents us from adding the ccitt oid
and its zeroDotZero subsidiary. Change this to check for o_name, which is
always set, because mibtree is filled by MIBDECL().
-rw-r--r-- | usr.bin/snmp/smi.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/usr.bin/snmp/smi.c b/usr.bin/snmp/smi.c index 70f5448f011..804a6830d1e 100644 --- a/usr.bin/snmp/smi.c +++ b/usr.bin/snmp/smi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smi.c,v 1.11 2020/08/08 07:18:08 martijn Exp $ */ +/* $OpenBSD: smi.c,v 1.12 2020/08/08 13:02:54 martijn Exp $ */ /* * Copyright (c) 2019 Martijn van Duren <martijn@openbsd.org> @@ -591,17 +591,11 @@ smi_oid2string(struct ber_oid *o, char *buf, size_t len, void smi_mibtree(struct oid *oids) { - struct oid *oid, *decl; size_t i; - for (i = 0; oids[i].o_oid[0] != 0; i++) { - oid = &oids[i]; - if (oid->o_name != NULL) { - RB_INSERT(oidtree, &smi_oidtree, oid); - RB_INSERT(keytree, &smi_keytree, oid); - continue; - } - decl = RB_FIND(oidtree, &smi_oidtree, oid); + for (i = 0; oids[i].o_name != NULL; i++) { + RB_INSERT(oidtree, &smi_oidtree, &(oids[i])); + RB_INSERT(keytree, &smi_keytree, &(oids[i])); } } |