summaryrefslogtreecommitdiff
path: root/usr.sbin/snmpd
AgeCommit message (Collapse)Author
2024-06-03Passing a NULL digest to SHA routines from libcrypto is no longerAnton Lindqvist
supported. ok tb@
2024-05-21remove prototypes with no matching function and externs with no varJonathan Gray
partly checked by millert@
2024-04-12In snmpd_metrics process keep file descriptors 0 1 2 open.Alexander Bluhm
stdin, stdout, stderr are reserverd. They should point to a terminal, a redirect file or pipe, or /dev/null. Closing them and allocating arbitrary files in those places is not good. Call closefrom with 4 to keep /dev/null open in snmpd_metrics. OK martijn@
2024-04-09Sync removal of setsid(), setpgid() and a few dup2() from relayd. They areTobias Heider
redundant since we call daemon() earlier. ok bluhm@
2024-04-08Call daemon() only in parent and before proc_exec() to avoid orphaning childTobias Heider
processes. Synced from relayd. ok florian@
2024-02-20Remove some now unused variables. Somehow missed in previous commit.Martijn van Duren
2024-02-20strptime() only touches the fields specified in the format string,Martijn van Duren
meaning there could be garbage left in the other fields. Somehow this only caused issues in mktime() when /etc/localtime is set to GMT. Initialize tm to 0. While here fix a type-O in the format string and make the invalid strlen for LAST-UPDATED message more consistent with the other 2 error messages. Found by and OK sthen@
2024-02-20trap receiver is special in that the OID is optional. Make sure that weMartijn van Duren
accept a NULL descriptor, which results in an OID length of 0. Found by and OK sthen@
2024-02-20Remove the packetid logic from ax.c. It's not used by snmpd and has someMartijn van Duren
serious flaws. Issue reported and analysis by Steffen Christgau. OK tb@
2024-02-08RFC2578 section 7.1 specifies the ranges and in the case of opaque theMartijn van Duren
format to which the values need to adhere. Implement checks, so that we don't send illegal values to the client. OK tb@
2024-02-06Let the config parser make use of the mib_string2oid().Martijn van Duren
If a descriptor is not found in the loaded MIB files it falls back to the old smi_oid2string(), which then throws a deprecation warning. This won't trigger for most cases in the default install, but the UCD-DISKIO-MIB and dependencies aren't included (yet?) (which can be fixed by manually including them via "mib directory") and there's a couple of misspellings (e.g. mib_2 vs mib-2, and usmStatsNotInTimeWindow vs usmStatsNotInTimeWindows). Feedback and OK tb@
2024-02-06Replace most smi_oid2string() calls with the new mib_oid2string().Martijn van Duren
smi_oid2string() is still called from trap handle context to not break any existing scripts. OK tb@
2024-02-06Load MIB files during startup. The default directory isMartijn van Duren
/usr/share/snmp/mibs, but one or more directories can be configured via the "mib directory" option. OK tb@
2024-01-27Implement an initial SMIv2 parser based around RFC257[89]. RFC2580 isn'tMartijn van Duren
supported yet. SMIv1 is not supported. Parsing is done in a strict manner, but except for the (deprecated) IPV6-TC MIB everything from IETF/IANA that I found parses. For now this code will be used OID<->name translations, but other functionality could be added in the future. This commit just includes the parser, usage and including the MIB files will be done in separate commits. Go ahead from tb@
2024-01-16Convert to imsg_get_fd() and remove unused proc_forward_imsg().Claudio Jeker
OK martijn@
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@