Hello, Mischa found that relayd's agentx support is pretty much unusable for the uninitiated, because you have to know the tables beforehand.
I managed to track it down to two issue with both snmpd and relayd. The fix is far from proper support for agentx, but it's good enough for going on a walk. This mail contains the snmp parts: 1) smi.c: I misread the manpage in that RB_NFIND can also return the searched object itself instead of always returning the next one. This oversight hasn't introduced any new issues, since the older code already returned the object itself. 2) mps.c: We don't look into the parent elements to see if the requested element is part of a registered tree. With both diffs applied: $ snmp walk -On 127.0.0.1 1.3.6.1.4.1.30155.3 .1.3.6.1.4.1.30155.3.2.1.1.1 = INTEGER: 1 .1.3.6.1.4.1.30155.3.2.1.2.1 = INTEGER: 3 .1.3.6.1.4.1.30155.3.2.1.3.1 = STRING: www .1.3.6.1.4.1.30155.3.2.1.4.1 = Counter64: 0 .1.3.6.1.4.1.30155.3.2.1.5.1 = INTEGER: 0 .1.3.6.1.4.1.30155.3.2.1.6.1 = INTEGER: 0 .1.3.6.1.4.1.30155.3.2.1.7.1 = INTEGER: 0 .1.3.6.1.4.1.30155.3.2.1.8.1 = INTEGER: 0 .1.3.6.1.4.1.30155.3.2.1.9.1 = INTEGER: 0 .1.3.6.1.4.1.30155.3.2.1.10.1 = INTEGER: 0 .1.3.6.1.4.1.30155.3.2.2.1.2 = INTEGER: 2 .1.3.6.1.4.1.30155.3.2.2.2.2 = INTEGER: 1 .1.3.6.1.4.1.30155.3.2.2.3.2 = STRING: httpproxy .1.3.6.1.4.1.30155.3.2.2.4.2 = Counter64: 0 .1.3.6.1.4.1.30155.3.2.2.5.2 = INTEGER: 0 .1.3.6.1.4.1.30155.3.2.2.6.2 = INTEGER: 0 .1.3.6.1.4.1.30155.3.2.2.7.2 = INTEGER: 0 .1.3.6.1.4.1.30155.3.2.2.8.2 = INTEGER: 0 .1.3.6.1.4.1.30155.3.2.2.9.2 = INTEGER: 0 .1.3.6.1.4.1.30155.3.2.2.10.2 = INTEGER: 0 .1.3.6.1.4.1.30155.3.2.5.1.1 = INTEGER: 1 .1.3.6.1.4.1.30155.3.2.5.1.2 = INTEGER: 2 .1.3.6.1.4.1.30155.3.2.5.1.3 = INTEGER: 3 .1.3.6.1.4.1.30155.3.2.5.2.1 = INTEGER: 0 .1.3.6.1.4.1.30155.3.2.5.2.2 = INTEGER: 0 .1.3.6.1.4.1.30155.3.2.5.2.3 = INTEGER: 0 .1.3.6.1.4.1.30155.3.2.5.3.1 = INTEGER: 1 .1.3.6.1.4.1.30155.3.2.5.3.2 = INTEGER: 1 .1.3.6.1.4.1.30155.3.2.5.3.3 = INTEGER: 2 .1.3.6.1.4.1.30155.3.2.5.4.1 = STRING: 10.0.0.1 .1.3.6.1.4.1.30155.3.2.5.4.2 = STRING: 10.0.0.2 .1.3.6.1.4.1.30155.3.2.5.4.3 = STRING: 127.0.0.1 .1.3.6.1.4.1.30155.3.2.5.5.1 = Hex-STRING: 0A 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 .1.3.6.1.4.1.30155.3.2.5.5.2 = Hex-STRING: 0A 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 .1.3.6.1.4.1.30155.3.2.5.5.3 = Hex-STRING: 7F 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 .1.3.6.1.4.1.30155.3.2.5.6.1 = INTEGER: 1 .1.3.6.1.4.1.30155.3.2.5.6.2 = INTEGER: 1 .1.3.6.1.4.1.30155.3.2.5.6.3 = INTEGER: 1 .1.3.6.1.4.1.30155.3.2.5.7.1 = INTEGER: 2 .1.3.6.1.4.1.30155.3.2.5.7.2 = INTEGER: 2 .1.3.6.1.4.1.30155.3.2.5.7.3 = INTEGER: 0 .1.3.6.1.4.1.30155.3.2.5.8.1 = INTEGER: 12 .1.3.6.1.4.1.30155.3.2.5.8.2 = INTEGER: 12 .1.3.6.1.4.1.30155.3.2.5.8.3 = INTEGER: 12 .1.3.6.1.4.1.30155.3.2.5.9.1 = INTEGER: 0 .1.3.6.1.4.1.30155.3.2.5.9.2 = INTEGER: 0 .1.3.6.1.4.1.30155.3.2.5.9.3 = INTEGER: 12 .1.3.6.1.4.1.30155.3.2.5.10.1 = INTEGER: 10 .1.3.6.1.4.1.30155.3.2.5.10.2 = INTEGER: 10 .1.3.6.1.4.1.30155.3.2.5.10.3 = INTEGER: 3 .1.3.6.1.4.1.30155.3.2.7.1.1 = INTEGER: 1 .1.3.6.1.4.1.30155.3.2.7.1.2 = INTEGER: 2 .1.3.6.1.4.1.30155.3.2.7.2.1 = STRING: webhosts:80 .1.3.6.1.4.1.30155.3.2.7.2.2 = STRING: fallback:80 .1.3.6.1.4.1.30155.3.2.7.3.1 = INTEGER: 0 .1.3.6.1.4.1.30155.3.2.7.3.2 = INTEGER: 0 OK? martijn@ Index: mps.c =================================================================== RCS file: /cvs/src/usr.sbin/snmpd/mps.c,v retrieving revision 1.25 diff -u -p -r1.25 mps.c --- mps.c 16 May 2019 05:00:00 -0000 1.25 +++ mps.c 25 Sep 2019 06:46:17 -0000 @@ -208,7 +208,20 @@ mps_getnextreq(struct snmp_message *msg, 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_nfind(&key); + do { + value = smi_find(&key); + if (value->o_flags == 0) + value = NULL; + if (key.o_id.bo_n != 0) + key.o_id.bo_n--; + } while (value == NULL && key.o_id.bo_n > 0); + if (value == NULL || !(value->o_flags & OID_REGISTERED)) { + bcopy(o, &key.o_id, sizeof(struct ber_oid)); + smi_oidlen(&key.o_id); /* Strip off any trailing .0. */ + value = smi_nfind(&key); + while (value != NULL && value->o_flags == 0) + value = smi_nfind(value); + } if (value == NULL) goto fail; Index: smi.c =================================================================== RCS file: /cvs/src/usr.sbin/snmpd/smi.c,v retrieving revision 1.24 diff -u -p -r1.24 smi.c --- smi.c 16 May 2019 05:00:00 -0000 1.24 +++ smi.c 25 Sep 2019 06:46:17 -0000 @@ -244,7 +244,11 @@ smi_find(struct oid *oid) struct oid * smi_nfind(struct oid *oid) { - return (RB_NFIND(oidtree, &smi_oidtree, oid)); + struct oid *n; + n = RB_NFIND(oidtree, &smi_oidtree, oid); + if (smi_oid_cmp(oid, n) == 0) + n = RB_NEXT(oidtree, &smi_oidtree, n); + return n; } struct oid *