summaryrefslogtreecommitdiff
path: root/usr.sbin/snmpd
AgeCommit message (Collapse)Author
2023-12-22Call log_setverbosity() directly after getopt() so that debuggingMartijn van Duren
information during config-parsing can be displayed. OK tb@
2023-12-22Remove a log_debug from usm_checkuser(). It would only display what is inMartijn van Duren
the config and was never actually displayed because of insufficient verbosity level during config-parsing and would display the wrong auth algorithm for SHA2. OK tb@
2023-12-21mib_init() and MIB() disappeared with mib.c, remove their declarations.Martijn van Duren
MIBDECL() and MIBEND are only used inside mib.h, so move their definition in there. OK tb@
2023-12-21Clean up snmpd's header situation.Martijn van Duren
With the help of tb@ and include-what-you-use. OK tb@
2023-12-18Add a family argument to host(). This allows us to force a specific addressMartijn van Duren
family for source-address, which must be in line with the destination address. OK jca@
2023-12-18Fix copy-paste error for setting source-address in trap receiver.Martijn van Duren
OK jca@
2023-12-18Fix two memory leaks:Martijn van Duren
- MIB_snmpInReadOnlys was tried to be registered twice, leading to a leak of the second instance. Prevent this mistake in the future by making a double registration fatal. - The response buffer is owned by the backend, so the backend must also free it. OK tb@
2023-12-12The OID inside snmpTrapOID is of type NOTIFICATION-TYPE, which does notMartijn van Duren
have a zero appended. OK tb@
2023-12-12Do a bitter cleanup after the config defined objects on shutdown.Martijn van Duren
OK tb@
2023-11-21Make RTFILTER/filter-routes a simple boolean assignment, since theMartijn van Duren
specific value isn't used anymore, and is just used to generate an argument for snmpd_metrics. OK tb@
2023-11-20In snmpe_writecb, don't call snmpe_prepare_read() when there's stillMartijn van Duren
data left inside sm_data. If there's an incomplete packet left in the buffer it will be called from snmpe_tryparse, if there's a complete packet left we can end up with new events from the tcp socket, which the tcp subsystem isn't prepared to handle. OK tb@
2023-11-16In appl_processpdu() no need to set avi_next, and only set av_next upMartijn van Duren
to varbindlen, since its only use is to print the varbindlist via appl_pdu_log() and both are further properly initialized in appl_request_upstream_resolve(). This fixes a cosmetic off by one for getbulk requests. OK tb@
2023-11-16avi_origid must also be set when transitioning out of theMartijn van Duren
APPL_VBSTATE_MUSTFILL state, else snmpd won't like use once we reach EOMV of our view of the world. OK tb@
2023-11-15Make sure we allocate the correct size for an appl_agentcap.Martijn van Duren
OK claudio@ miod@
2023-11-13Apparently base-gcc doesn't like having OID() inside MIBDECL(). HandrollMartijn van Duren
the OID() logic into MIBDECL(). Found, tested, and OK jca@ OK tb@
2023-11-13struct appl_varbind_internal's avi_index is used to give the index toMartijn van Duren
the original varbindlist's index. In the case of a GetBulkRequest this must never be larger than the length of the original varbindlist. OK tb@
2023-11-12Move struct oid from snmpd.h into smi.c and trim a lot of the now unusedMartijn van Duren
fat. This includes all the o_flags member related defines. if it compiles ship it/OK tb@
2023-11-12Remove a bunch of unused smi_ functions and move a couple of definitionsMartijn van Duren
out of snmpd.h, which aren't used outside of smi.c OK tb@
2023-11-12Now that smi_oid_cmp() is only used by the oidtree RB-tree, and nothingMartijn van Duren
fancy is using it, we can simply rely on ober_oid_cmp(). OK tb@
2023-11-12Now that MIBDECL() fills in bo_n, no need to call smi_oidlen() anymore.Martijn van Duren
OK tb@
2023-11-12Let MIBDECL() make use of OID(). This gives use bo_n for free and weMartijn van Duren
won't have to rely on error-prone smi_oidlen. OK tb@
2023-11-12Now that smi.c is basically an oid/name translator, let smi_insert()Martijn van Duren
create the struct oid and let parse.y supply the arguments. OK tb@
2023-11-12No need to use struct oid to compare two struct ber_oids. Just callMartijn van Duren
ober_oid_cmp() directly. OK tb@
2023-11-12Printing all known objects inside smi when build with -DDEBUG has noMartijn van Duren
benefit. Remove it and the last consumer of smi_foreach(). OK tb@
2023-11-12No reason to call (error-prone) smi_scalar_oidlen when we include theMartijn van Duren
scalar .0 ourselves. OK tb@
2023-11-12Now that the last consumer of mps.c is gone, remove it and itsMartijn van Duren
application_legacy.c companion. OK tb@
2023-11-12Move snmpd.conf's oid keyword into application_internal.c. These objectsMartijn van Duren
get registered under their own backend name, so that they can't overlap with the internal regions. This removes the last consumer of mps.c OK tb@
2023-11-08Don't do the time window check if we're noAuthNoPriv. It's only neededMartijn van Duren
if we're authenticating according to RFC3414 section 2.3. OK tb@
2023-11-08Let usm_make_report() utilize appl_report(). usm_make_report utilizedMartijn van Duren
mps_getstr(), which after moving the SNMPv2-SMI::snmpV2 into application_internal returned a noSuchObject. This doesn't seem to have broken any tools that I'm aware of, but this returns the correct result. OK tb@
2023-11-08Let appl_report() collect its own metrics. This simplifies the interfaceMartijn van Duren
and gives us a free report-pdu log line in debug mode. OK tb@
2023-11-08Don't rely on aru_pdu to rebuild the original varbindlist on error.Martijn van Duren
Now that we have avi_origid it's not needed anymore and aru_pdu needs to go. OK tb@
2023-11-08Don't use aru_pdu for determining the requesttype. It's owned byMartijn van Duren
snmp_message and getting rid of it is also needed for appl_report() to gather its own information. OK tb@
2023-11-08On second thought let's not overwrite sm_pdutype with a hardcoded valueMartijn van Duren
after just setting it, it's a silly idea. OK tb@
2023-11-08export SNMP-TARGET-MIB::{snmpUnavailableContexts,snmpUnknownContexts}Martijn van Duren
via application_internal. OK tb@
2023-11-08Hook up snmpTargetMIB to MIB_TREE.Martijn van Duren
OK tb@
2023-11-06Hook up agentx-{Add,Remove}AgentCaps-PDU to appl_{add,remove}agentcaps.Martijn van Duren
OK tb@
2023-11-06Readd the sysORTable based on the new struct appl_agentcap.Martijn van Duren
OK tb@
2023-11-06Allow agent capabilities to be stored on a per appl_context basis.Martijn van Duren
This is needed for AgentX's {add,remove}agentcaps, and the sysORTable. OK tb@
2023-11-06Allow appl_internal_object's getnext to be called.Martijn van Duren
OK tb@
2023-11-04Move SNMPv2-MIB::system from mib.c into the new application_internal.c.Martijn van Duren
This was the last consumer of mib.c, so send it to the great bitbucket in the sky. This move removes the sysORTable, but it was basically non-functioning anyway and removal of previous entries from the table didn't caused any fallout that reached my ears. I hope to add proper sysORTable/agent-capabilities support, which is compatible with AgentX's {Add,Remove}AgentCaps, soon. OK tb@
2023-11-04Move SNMPv2-SMI::snmpV2 from mib.c into the new application_internal.cMartijn van Duren
OK tb@
2023-11-04Move SNMPv2-MIB::snmp from mib.c into the new application_internal.cMartijn van Duren
OK tb@
2023-11-04Introduce application_internal.c. This backend is meant to replaceMartijn van Duren
application_legacy.c, mps.c, and mib.c. This commit just introduces the backend. The existing MIBs inside mib.c will be copied over in subsequent commits. OK tb@
2023-10-29When doing a get{next,bulk} below an instance we must move the OID toMartijn van Duren
the next sibling. Not simply copying over the value of the next to use region, since that might be the parent and we would walk backwards in the tree. OK tb@
2023-10-29searchrange.end is non-inclusive. Adjust the tests for that.Martijn van Duren
OK tb@
2023-10-27If an invalid varbindlist was returned by a backend we would callMartijn van Duren
appl_request_upstream_resolve() twice where the first call would already return a reply and free the upstream request, leading to a use after free. Make appl_request_downstream_free() call appl_request_upstream_resolve() unconditionally and remove the call from appl_response(). OK tb@
2023-10-27Use event_add(), instead of calling appl_agentx_send() directly. If anMartijn van Duren
error occurs the connection will be freed and if the caller uses the connection afterwards it will lead to a use after free. OK tb@
2023-10-24FC3416 section 4.2.1 (and others) tells us that if an error occurs theMartijn van Duren
varbindlist in the response must be identical to the original request. OK tb@
2023-10-24Certain error codes are only intended for certain request-types. Add anMartijn van Duren
appl_error_valid() function to test for this. OK tb@
2023-10-24If a backend registers as an instance it must never return OIDs belowMartijn van Duren
their registration. Add a test for this in appl_varbind_valid(). OK and minor nit tb@