OpenBSD CVS

CVS log for src/usr.sbin/snmpd/smi.c


[BACK] Up to [local] / src / usr.sbin / snmpd

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.40 / (download) - annotate - [select for diffs], Tue Feb 6 12:44:27 2024 UTC (4 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.39: +3 -3 lines
Diff to previous 1.39 (colored)

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@

Revision 1.39 / (download) - annotate - [select for diffs], Thu Dec 21 12:43:31 2023 UTC (5 months, 2 weeks ago) by martijn
Branch: MAIN
Changes since 1.38: +12 -23 lines
Diff to previous 1.38 (colored)

Clean up snmpd's header situation.

With the help of tb@ and include-what-you-use.

OK tb@

Revision 1.38 / (download) - annotate - [select for diffs], Sun Nov 12 20:14:39 2023 UTC (6 months, 3 weeks ago) by martijn
Branch: MAIN
Changes since 1.37: +12 -9 lines
Diff to previous 1.37 (colored)

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@

Revision 1.37 / (download) - annotate - [select for diffs], Sun Nov 12 20:12:01 2023 UTC (6 months, 3 weeks ago) by martijn
Branch: MAIN
Changes since 1.36: +6 -82 lines
Diff to previous 1.36 (colored)

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@

Revision 1.36 / (download) - annotate - [select for diffs], Sun Nov 12 20:10:13 2023 UTC (6 months, 3 weeks ago) by martijn
Branch: MAIN
Changes since 1.35: +2 -20 lines
Diff to previous 1.35 (colored)

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@

Revision 1.35 / (download) - annotate - [select for diffs], Sun Nov 12 20:07:48 2023 UTC (6 months, 3 weeks ago) by martijn
Branch: MAIN
Changes since 1.34: +1 -2 lines
Diff to previous 1.34 (colored)

Now that MIBDECL() fills in bo_n, no need to call smi_oidlen() anymore.

OK tb@

Revision 1.34 / (download) - annotate - [select for diffs], Sun Nov 12 20:04:35 2023 UTC (6 months, 3 weeks ago) by martijn
Branch: MAIN
Changes since 1.33: +18 -13 lines
Diff to previous 1.33 (colored)

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@

Revision 1.33 / (download) - annotate - [select for diffs], Sat Nov 4 09:38:47 2023 UTC (7 months ago) by martijn
Branch: MAIN
Changes since 1.32: +3 -2 lines
Diff to previous 1.32 (colored)

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@

Revision 1.32 / (download) - annotate - [select for diffs], Thu Oct 6 14:41:08 2022 UTC (20 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.31: +2 -4 lines
Diff to previous 1.31 (colored)

Remove a lot of old (dead) code that's either been superseded, or moved to
snmpd_metrics.

OK benno@ sthen@

Revision 1.31 / (download) - annotate - [select for diffs], Thu Jun 30 09:42:19 2022 UTC (23 months, 1 week ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.30: +138 -2 lines
Diff to previous 1.30 (colored)

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@

Revision 1.30 / (download) - annotate - [select for diffs], Thu Oct 21 15:08:15 2021 UTC (2 years, 7 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.29: +3 -3 lines
Diff to previous 1.29 (colored)

Clean up the naming of SNMP_C_GETNEXTREQ and SNMP_C_RESPONSE inside
smi_debug_elements

OK sthen@

Revision 1.29 / (download) - annotate - [select for diffs], Thu Oct 21 14:33:13 2021 UTC (2 years, 7 months ago) by martijn
Branch: MAIN
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)

s/SNMP_C_GETRESP/SNMP_C_RESPONSE

OK sthen@

Revision 1.28 / (download) - annotate - [select for diffs], Mon Jan 4 07:59:54 2021 UTC (3 years, 5 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.27: +1 -14 lines
Diff to previous 1.27 (colored)

Remove BER_TYPE_BOOLEAN, it's not part of the spec and I haven't seen it
used anywhere.

OK jan@

Revision 1.26.2.1 / (download) - annotate - [select for diffs], Sun Oct 27 20:05:13 2019 UTC (4 years, 7 months ago) by tb
Branch: OPENBSD_6_6
Changes since 1.26: +9 -9 lines
Diff to previous 1.26 (colored) next main 1.27 (colored)

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

OpenBSD 6.6 errata 002

Revision 1.27 / (download) - annotate - [select for diffs], Thu Oct 24 12:39:27 2019 UTC (4 years, 7 months ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.26: +9 -9 lines
Diff to previous 1.26 (colored)

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

Revision 1.26 / (download) - annotate - [select for diffs], Wed Oct 9 06:37:53 2019 UTC (4 years, 8 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE
Branch point for: OPENBSD_6_6
Changes since 1.25: +1 -5 lines
Diff to previous 1.25 (colored)

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@

Revision 1.25 / (download) - annotate - [select for diffs], Thu Oct 3 12:00:40 2019 UTC (4 years, 8 months ago) by martijn
Branch: MAIN
Changes since 1.24: +6 -2 lines
Diff to previous 1.24 (colored)

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@

Revision 1.24 / (download) - annotate - [select for diffs], Thu May 16 05:00:00 2019 UTC (5 years ago) by martijn
Branch: MAIN
Changes since 1.23: +7 -1 lines
Diff to previous 1.23 (colored)

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.

Revision 1.23 / (download) - annotate - [select for diffs], Thu Dec 13 10:54:29 2018 UTC (5 years, 5 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.22: +2 -2 lines
Diff to previous 1.22 (colored)

fix printf statements when compiled with -DDEBUG.

OK deraadt@, tb@, claudio@

Revision 1.22 / (download) - annotate - [select for diffs], Tue Jul 31 11:01:29 2018 UTC (5 years, 10 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

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@

Revision 1.21 / (download) - annotate - [select for diffs], Mon Jul 23 19:51:39 2018 UTC (5 years, 10 months ago) by rob
Branch: MAIN
Changes since 1.20: +1 -1 lines
Diff to previous 1.20 (colored)

Add missing $OpenBSD$ CVS tag.

Revision 1.20 / (download) - annotate - [select for diffs], Fri Oct 28 08:01:53 2016 UTC (7 years, 7 months ago) by rzalamena
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.19: +3 -5 lines
Diff to previous 1.19 (colored)

Use snmpd_env as the only global variable for env to simplify the daemon
and avoid problems.

ok jca@

Revision 1.19 / (download) - annotate - [select for diffs], Sat Dec 5 06:42:18 2015 UTC (8 years, 6 months ago) by mmcc
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.18: +2 -4 lines
Diff to previous 1.18 (colored)

strings.h -> string.h to prevent an implicit declaration warning. Also
remove a handful of NULL-checks before free().

Revision 1.18 / (download) - annotate - [select for diffs], Fri Aug 21 08:29:06 2015 UTC (8 years, 9 months ago) by reyk
Branch: MAIN
Changes since 1.17: +1 -1 lines
Diff to previous 1.17 (colored)

Use reallocarray() instead of malloc() before strvisx().

Found by deraadt@
OK blambert@

Revision 1.17 / (download) - annotate - [select for diffs], Fri Jan 16 00:05:13 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.16: +5 -3 lines
Diff to previous 1.16 (colored)

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

Revision 1.16 / (download) - annotate - [select for diffs], Wed Nov 19 10:19:00 2014 UTC (9 years, 6 months ago) by blambert
Branch: MAIN
Changes since 1.15: +7 -4 lines
Diff to previous 1.15 (colored)

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@

Revision 1.15 / (download) - annotate - [select for diffs], Mon Apr 28 12:48:36 2014 UTC (10 years, 1 month ago) by blambert
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.14: +2 -1 lines
Diff to previous 1.14 (colored)

fix memory leak

ok reyk@

Revision 1.14 / (download) - annotate - [select for diffs], Tue Oct 1 15:19:12 2013 UTC (10 years, 8 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.13: +2 -2 lines
Diff to previous 1.13 (colored)

Tell strvisx() to encode newlines found in octet-strings to avoid ugly
line wraps.

Revision 1.13 / (download) - annotate - [select for diffs], Tue Oct 1 12:44:31 2013 UTC (10 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (colored)

fix typo

Revision 1.12 / (download) - annotate - [select for diffs], Tue Oct 1 12:41:47 2013 UTC (10 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.11: +66 -3 lines
Diff to previous 1.11 (colored)

Add initial SNMP client utility to snmpctl(8).
For example, snmpctl snmp walk 127.0.0.1

commit it deraadt@

Revision 1.11 / (download) - annotate - [select for diffs], Thu Sep 26 09:11:29 2013 UTC (10 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.10: +278 -1 lines
Diff to previous 1.10 (colored)

shuffle some snmpd functions to make them visible in smi.c for snmpctl.

ok gerhard@ blambert@

Revision 1.10 / (download) - annotate - [select for diffs], Thu Sep 26 08:12:40 2013 UTC (10 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.9: +2 -1 lines
Diff to previous 1.9 (colored)

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).

Revision 1.9 / (download) - annotate - [select for diffs], Fri Jun 21 07:07:55 2013 UTC (10 years, 11 months ago) by gerhard
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.8: +3 -1 lines
Diff to previous 1.8 (colored)

Bzero() the whole key before doing an RB_FIND() because smi_oid_cmp()
looks at more members than just 'o_id'.

ok reyk@

Revision 1.8 / (download) - annotate - [select for diffs], Mon Sep 17 16:43:59 2012 UTC (11 years, 8 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored)

Update copyright and my email address in snmpd while I'm here.

Revision 1.7 / (download) - annotate - [select for diffs], Wed Feb 1 18:44:06 2012 UTC (12 years, 4 months ago) by camield
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.6: +11 -1 lines
Diff to previous 1.6 (colored)

Variable bindings need instance identifiers, for scalars this is always .0.
At least NetSNMP and HPOV now understand it.

ok joel@

Revision 1.6 / (download) - annotate - [select for diffs], Wed Dec 16 22:17:53 2009 UTC (14 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.5: +4 -2 lines
Diff to previous 1.5 (colored)

knf and unused variables

Revision 1.5 / (download) - annotate - [select for diffs], Wed Jan 16 09:51:15 2008 UTC (16 years, 4 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored)

bump copyright

Revision 1.4 / (download) - annotate - [select for diffs], Fri Jan 4 12:57:40 2008 UTC (16 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.3: +2 -1 lines
Diff to previous 1.3 (colored)

always bzero the oid lookup key before initializing it.

Revision 1.3 / (download) - annotate - [select for diffs], Wed Jan 2 20:54:59 2008 UTC (16 years, 5 months ago) by maja
Branch: MAIN
Changes since 1.2: +4 -3 lines
Diff to previous 1.2 (colored)

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@

Revision 1.2 / (download) - annotate - [select for diffs], Sat Dec 29 09:24:43 2007 UTC (16 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.1: +4 -3 lines
Diff to previous 1.1 (colored)

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.

Revision 1.1 / (download) - annotate - [select for diffs], Fri Dec 28 16:59:31 2007 UTC (16 years, 5 months ago) by reyk
Branch: MAIN

split code handling the "structure of management information" and the
"message processing subsystem" into separate files smi.c and mps.c

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.