diff options
author | martijn <martijn@openbsd.org> | 2019-05-16 05:00:00 +0000 |
---|---|---|
committer | martijn <martijn@openbsd.org> | 2019-05-16 05:00:00 +0000 |
commit | 9aae882a817ec1dff1c7f660dc46ddd6313f7c45 (patch) | |
tree | 2eaa15897e2f1bf0d8d1b27677399fa358386ff7 /usr.sbin/snmpd | |
parent | Handle a bit more work without taking the kernel lock. This should avoid (diff) | |
download | wireguard-openbsd-9aae882a817ec1dff1c7f660dc46ddd6313f7c45.tar.xz wireguard-openbsd-9aae882a817ec1dff1c7f660dc46ddd6313f7c45.zip |
Allow arbitrary oids to be specified for the getnext request, instead of
oids needing to be part of the snmpd loaded tree.
This is in line with RFC3416.
OK gerhard@ who apparently has the exact same diff in his repo.
Diffstat (limited to 'usr.sbin/snmpd')
-rw-r--r-- | usr.sbin/snmpd/mps.c | 4 | ||||
-rw-r--r-- | usr.sbin/snmpd/smi.c | 8 | ||||
-rw-r--r-- | usr.sbin/snmpd/snmpd.h | 3 |
3 files changed, 11 insertions, 4 deletions
diff --git a/usr.sbin/snmpd/mps.c b/usr.sbin/snmpd/mps.c index 2fcf03489b4..9d12def1d5e 100644 --- a/usr.sbin/snmpd/mps.c +++ b/usr.sbin/snmpd/mps.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mps.c,v 1.24 2016/10/28 08:01:53 rzalamena Exp $ */ +/* $OpenBSD: mps.c,v 1.25 2019/05/16 05:00:00 martijn Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org> @@ -208,7 +208,7 @@ mps_getnextreq(struct snmp_message *msg, struct ber_element *root, bzero(&key, sizeof(key)); bcopy(o, &key.o_id, sizeof(struct ber_oid)); smi_oidlen(&key.o_id); /* Strip off any trailing .0. */ - value = smi_find(&key); + value = smi_nfind(&key); if (value == NULL) goto fail; diff --git a/usr.sbin/snmpd/smi.c b/usr.sbin/snmpd/smi.c index a307b57aa66..d50d5da7884 100644 --- a/usr.sbin/snmpd/smi.c +++ b/usr.sbin/snmpd/smi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smi.c,v 1.23 2018/12/13 10:54:29 martijn Exp $ */ +/* $OpenBSD: smi.c,v 1.24 2019/05/16 05:00:00 martijn Exp $ */ /* * Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org> @@ -242,6 +242,12 @@ smi_find(struct oid *oid) } struct oid * +smi_nfind(struct oid *oid) +{ + return (RB_NFIND(oidtree, &smi_oidtree, oid)); +} + +struct oid * smi_findkey(char *name) { struct oid oid; diff --git a/usr.sbin/snmpd/snmpd.h b/usr.sbin/snmpd/snmpd.h index b97333fd8af..5d5adfd1321 100644 --- a/usr.sbin/snmpd/snmpd.h +++ b/usr.sbin/snmpd/snmpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpd.h,v 1.82 2019/05/11 17:46:02 rob Exp $ */ +/* $OpenBSD: snmpd.h,v 1.83 2019/05/16 05:00:00 martijn Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org> @@ -724,6 +724,7 @@ int smi_init(void); u_long smi_getticks(void); void smi_mibtree(struct oid *); struct oid *smi_find(struct oid *); +struct oid *smi_nfind(struct oid *); struct oid *smi_findkey(char *); struct oid *smi_next(struct oid *); struct oid *smi_foreach(struct oid *, u_int); |