1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-03 06:45:37 -08:00
Commit Graph

40 Commits

Author SHA1 Message Date
martijn
f0bcdb5c62 Replace most smi_oid2string() calls with the new mib_oid2string().
smi_oid2string() is still called from trap handle context to not break
any existing scripts.

OK tb@
2024-02-06 12:44:27 +00:00
martijn
a9292d2a63 Clean up snmpd's header situation.
With the help of tb@ and include-what-you-use.

OK tb@
2023-12-21 12:43:30 +00:00
martijn
9dc90119e2 Move struct oid from snmpd.h into smi.c and trim a lot of the now unused
fat. This includes all the o_flags member related defines.

if it compiles ship it/OK tb@
2023-11-12 20:14:39 +00:00
martijn
46c28d35e9 Remove a bunch of unused smi_ functions and move a couple of definitions
out of snmpd.h, which aren't used outside of smi.c

OK tb@
2023-11-12 20:12:01 +00:00
martijn
5135a24432 Now that smi_oid_cmp() is only used by the oidtree RB-tree, and nothing
fancy is using it, we can simply rely on ober_oid_cmp().

OK tb@
2023-11-12 20:10:13 +00:00
martijn
f7925f75ce Now that MIBDECL() fills in bo_n, no need to call smi_oidlen() anymore.
OK tb@
2023-11-12 20:07:48 +00:00
martijn
d791c660a1 Now that smi.c is basically an oid/name translator, let smi_insert()
create the struct oid and let parse.y supply the arguments.

OK tb@
2023-11-12 20:04:35 +00:00
martijn
60cc2743c9 Move SNMPv2-MIB::system from mib.c into the new application_internal.c.
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-04 09:38:47 +00:00
martijn
5f1d9bbf0b Remove a lot of old (dead) code that's either been superseded, or moved to
snmpd_metrics.

OK benno@ sthen@
2022-10-06 14:41:08 +00:00
martijn
2c7b58e5a8 Rewrite smi_print_element to be more concise and complete.
Keep the old implementation around as smi_print_element_legacy for the
trap handler scripts, so these don't break.

Should help with request tracing.

OK sthen@
2022-06-30 09:42:19 +00:00
martijn
4b5936d979 Clean up the naming of SNMP_C_GETNEXTREQ and SNMP_C_RESPONSE inside
smi_debug_elements

OK sthen@
2021-10-21 15:08:15 +00:00
martijn
151420acaa s/SNMP_C_GETRESP/SNMP_C_RESPONSE
OK sthen@
2021-10-21 14:33:13 +00:00
martijn
b8e3988f57 Remove BER_TYPE_BOOLEAN, it's not part of the spec and I haven't seen it
used anywhere.

OK jan@
2021-01-04 07:59:54 +00:00
tb
696b58997f The ber_* namespace is used by liblber since time immemorial,
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-10-24 12:39:26 +00:00
martijn
3aad807302 Revert previous. This introduces problems when requesting the base oid of a
scalar.

For example if you getnext request 1.3.6.1.4.1.30155.6.1.1 you get a
varbind oid of 1.3.6.1.4.1.30155.6.1.1.0, but the value of
1.3.6.1.4.1.30155.6.1.2.0.  I have a fix in the making, but we're too close
to release and here be too many dragons.

Found by bluhm@
2019-10-09 06:37:53 +00:00
martijn
ec87eb27f5 For getnext request check if the requested oid or one of its parent
elements exists and is a (agentx) registered element. If so, forward the
getnext to the subagent, else get the actual next element.

This is only a partial fix, but lets us at least (together with a different
patch for relayd) walk relayd's elements.

OK claudio@
2019-10-03 12:00:40 +00:00
martijn
9aae882a81 Allow arbitrary oids to be specified for the getnext request, instead of
oids needing to be part of the snmpd loaded tree.

This is in line with RFC3416.

OK gerhard@ who apparently has the exact same diff in his repo.
2019-05-16 05:00:00 +00:00
martijn
d0e5511c76 fix printf statements when compiled with -DDEBUG.
OK deraadt@, tb@, claudio@
2018-12-13 10:54:29 +00:00
claudio
8d831f143c Make ber type and encoding a unsigned int instead of unsigned long.
This way the size is the same on all archs and 32bit should be good enough.
OK rob@
2018-07-31 11:01:29 +00:00
rob
24298a4982 Add missing $OpenBSD$ CVS tag. 2018-07-23 19:51:39 +00:00
rzalamena
4f6e7cab18 Use snmpd_env as the only global variable for env to simplify the daemon
and avoid problems.

ok jca@
2016-10-28 08:01:53 +00:00
mmcc
c8077e090a strings.h -> string.h to prevent an implicit declaration warning. Also
remove a handful of NULL-checks before free().
2015-12-05 06:42:18 +00:00
reyk
882b1c9d43 Use reallocarray() instead of malloc() before strvisx().
Found by deraadt@
OK blambert@
2015-08-21 08:29:06 +00:00
deraadt
9b2ea7723b first batch of cleanup to programs based upon the namespace cleanups
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
2015-01-16 00:05:12 +00:00
blambert
552ac9e764 add support for AgentX subagents in snmpd
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@
2014-11-19 10:19:00 +00:00
blambert
7a44d664c0 fix memory leak
ok reyk@
2014-04-28 12:48:36 +00:00
reyk
e6b2136a57 Tell strvisx() to encode newlines found in octet-strings to avoid ugly
line wraps.
2013-10-01 15:19:12 +00:00
reyk
12ee10e307 fix typo 2013-10-01 12:44:31 +00:00
reyk
65a06029ea Add initial SNMP client utility to snmpctl(8).
For example, snmpctl snmp walk 127.0.0.1

commit it deraadt@
2013-10-01 12:41:47 +00:00
reyk
63962927b3 shuffle some snmpd functions to make them visible in smi.c for snmpctl.
ok gerhard@ blambert@
2013-09-26 09:11:29 +00:00
reyk
b224c015bf smi is an SNMP term that means "Structure of Managed Information". I
thought about renaming the functions to just "snmp", but "smi" totally
makes sense.  So add a comment that explains the meaning of SMI (not life).
2013-09-26 08:12:40 +00:00
gerhard
f22c8f53de Bzero() the whole key before doing an RB_FIND() because smi_oid_cmp()
looks at more members than just 'o_id'.

ok reyk@
2013-06-21 07:07:55 +00:00
reyk
8ed9427bef Update copyright and my email address in snmpd while I'm here. 2012-09-17 16:43:59 +00:00
camield
dda75a53a6 Variable bindings need instance identifiers, for scalars this is always .0.
At least NetSNMP and HPOV now understand it.

ok joel@
2012-02-01 18:44:06 +00:00
deraadt
a69653e58f knf and unused variables 2009-12-16 22:17:53 +00:00
reyk
53c2571226 bump copyright 2008-01-16 09:51:15 +00:00
reyk
265e026217 always bzero the oid lookup key before initializing it. 2008-01-04 12:57:40 +00:00
maja
cda0a94cf1 Make sure that a key belongs to the table before returning a match.
Change smi_odi_cmp to return int as expected by RB-tree. -moj

ok reyk@
2008-01-02 20:54:59 +00:00
reyk
ea073d8dfa add the IP-MIB ipAddrTable. it requires to encode the ipv4 addresses
in the OIDs as the table index.  the next step is to simplify the
common mib implementation regarding the special requirements of these
strange snmp tables.
2007-12-29 09:24:43 +00:00
reyk
b0ced6a29a split code handling the "structure of management information" and the
"message processing subsystem" into separate files smi.c and mps.c
2007-12-28 16:59:31 +00:00