summaryrefslogtreecommitdiff
path: root/usr.sbin/snmpd
AgeCommit message (Collapse)Author
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@
2023-10-24set ab_range explicitly to 1 for appl_agentx_session instead of relyingMartijn van Duren
on malloc random garbage. OK tb@
2023-10-24When returning an endOfMibView we must always set it on the requested OID.Martijn van Duren
OK tb@
2023-10-24When opening 2 sessions on an agentx connection and registering 2Martijn van Duren
overlapping regions on the different sessions, e.g. by differing in priority and we close the underlying connection with an outstanding request to the dominant region we will call appl_agentx_free(), which sequentially closes all sessions. If the session with the outstanding request is closed before the second session the request is retried before said session is cleaned up and it will try to send it over a conn_ax which at that point has been set to NULL, resulting in a SIGSEGV. Simply return early and let this second request be cancelled by the cleanup of the second session. OK tb@
2023-10-24Fix appl_unregister() when called with range_subid set to !0.Martijn van Duren
OK tb@
2023-10-24Fix appl_register() when called with range_subid set to !0.Martijn van Duren
OK tb@
2023-10-24RFC2741 section 6.2.2 says that reasonByManager can only be used by theMartijn van Duren
agentx master. Treat this reason as a parseerror. OK tb@
2023-10-24appl_agentx_free() closes any open sessions before freeing everything up.Martijn van Duren
Up until now all sessions were closed with reasonShutdown, which is not accurate for every situation. Give it an additional reason argument that propagates to appl_agentx_forceclose(). OK tb@
2023-10-24Always check if the context is available inside appl_agentx_recv().Martijn van Duren
Not every PDU goes through application.c. OK tb@
2023-10-24Verify if supplied AgentX PDU header flags are valid for given PDU typeMartijn van Duren
inside appl_agentx_recv(). While here clean up the logging a bit. OK tb@