summaryrefslogtreecommitdiff
path: root/usr.sbin/snmpd/util.c
AgeCommit message (Collapse)Author
2021-08-09Allow setting the engineid.Martijn van Duren
The previous engineid was based aronud the engine boottime and a random value, which gives problems when sending/receiving unacknowledged PDUs (trapv2) over SNMPv3 with authentication enabled, which need a consistent engineid across restarts to determine the correct user from the sender. The new default engineid takes a sha256 hash (chosen for its longer output) of gethostname(3) and places the first 27 bytes after the new format number 129. This should give us a very low probability of collisions, assuming all machines have a unique name. The other formats as specified in SNMP-FRAMEWORK-MIB (RFC3411) are also supported as well as arbitrary formats in the range 128-255 for other private enterprise numbers in hex format. OK jmatthew@
2021-01-28Remove print_{debug,verbose} since they're currently unused and I see noMartijn van Duren
reason to start using them in the future. OK tb@
2020-06-30Remove agentx and control socket support.Martijn van Duren
snmpctl has been removed two releases ago, which makes the control interface obsolete. agentx support has always been quirky at best, but got completely broken with the BER_MAX_OID_LEN increase in ber.h. This change resulted in the oid length on the snmp side being left uninitialized because of size difference, resulting in weird behaviour. No one reported the breakage, even after 6.7 was released. This change requires users to remove the socket keyword from their snmpd.conf. OK denis@
2019-10-24The ber_* namespace is used by liblber since time immemorial,Theo Buehler
so move our BER API to the unused ober_* prefix to avoid some breakage in ports. Problem diagnosed by jmatthew with ber_free() in samba, but there are many others as pointed out by sthen. tests & ok rob ok sthen (who had an almost identical diff for libutil) "go head hit it" deraadt
2019-05-11The BER API is currently used by ldap, ldapd, ldapctl, ypldap, snmpd, androb
snmpctl. Separate copies of ber.[ch] have existed and been maintained in sync in ldap, ldapd, ypldap and snmpd. This commit moves the BER API into /usr/lib/libutil. All current consumers already link libutil. ldapd and snmpd regress passes, and release builds. With help from tb@ and guenther@. ok deraadt@, tb@
2017-01-09Stop accessing verbose and debug variables from log.c directly.Reyk Floeter
This replaces log_verbose() and "extern int verbose" with the two functions log_setverbose() and log_getverbose(). Pointed out by benno@ OK krw@ eric@ gilles@ (OK gilles@ for the snmpd bits as well)
2016-11-09Improve source IP address handling.Jeremie Courreges-Anglas
- send replies using a source address equal to the destination address of queries, using IP_SENDSRCADDR. This help in multihomed setups and can remove the need to explicitely configure a bind address. - config knob to set the source address of packets sent to trap receivers. "trap receiver" gains an optional "source-address" setting. Source address issues reported by Andy Lemin. ok benno@
2015-11-21Move local logging functions to util.c and copy log.c from iked. NowReyk Floeter
a copy of the same log.c file is shared by relayd, httpd, iked, and snmpd. No functional changes.
2015-07-20properly encode IpAddress, Gauge32, and Counter32Bret Lambert
varbinds received from subagents ok reyk@
2015-01-22Replace some obvious '$OpenBSD' and '$OpenBSD:' typos with '$OpenBSD$'.Kenneth R Westerback
Pointed out by dickman@. ok sthen@ phessler@
2015-01-16first batch of cleanup to programs based upon the namespace cleanupsTheo de Raadt
in net/pfvar.h sys/proc.h sys/ucred.h arpa/nameser.h change to PATH_MAX, reduce use of MIN() and MAX(), HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc etc ok millert guenther, some review by doug
2014-11-19add support for AgentX subagents in snmpdBret Lambert
snmp requests are now packaged into pseudo-continuations to allow for being dispatched to seperate processes; lightly tested for interoperability with NetSNMP, but doesn't implement the complete set of AgentX messages while here, clean up return types of mps_get* functions, and make smi_insert refuse to insert duplicate OIDs okay benno@ reyk@