OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


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

Let the config parser make use of the mib_string2oid().
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@

Revision 1.42 / (download) - annotate - [select for diffs], Tue Feb 6 12:44:28 2024 UTC (4 months ago) by martijn
Branch: MAIN
Changes since 1.41: +2 -2 lines
Diff to previous 1.41 (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.41 / (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.40: +7 -16 lines
Diff to previous 1.40 (colored)

Clean up snmpd's header situation.

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

OK tb@

Revision 1.40 / (download) - annotate - [select for diffs], Tue Dec 12 20:18:39 2023 UTC (5 months, 3 weeks ago) by martijn
Branch: MAIN
Changes since 1.39: +2 -2 lines
Diff to previous 1.39 (colored)

The OID inside snmpTrapOID is of type NOTIFICATION-TYPE, which does not
have a zero appended.

OK tb@

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

No need to use struct oid to compare two struct ber_oids. Just call
ober_oid_cmp() directly.

OK tb@

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

No reason to call (error-prone) smi_scalar_oidlen when we include the
scalar .0 ourselves.

OK tb@

Revision 1.37 / (download) - annotate - [select for diffs], Thu Sep 2 05:41:02 2021 UTC (2 years, 9 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.36: +52 -50 lines
Diff to previous 1.36 (colored)

Allow snmpd(8) to send SNMPv3 traps.

OK jmatthew@

Revision 1.36 / (download) - annotate - [select for diffs], Sun Sep 6 15:51:28 2020 UTC (3 years, 9 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.35: +6 -7 lines
Diff to previous 1.35 (colored)

Split "trap receiver" into its own trap_address struct and clean up the
code surrounding this struct and struct address.

No functional change intended, except that trap receiver's source-address
may now be a resolvable hostname.

Tweaks and OK jan@

Revision 1.35 / (download) - annotate - [select for diffs], Tue Jun 30 17:11:49 2020 UTC (3 years, 11 months ago) by martijn
Branch: MAIN
Changes since 1.34: +1 -93 lines
Diff to previous 1.34 (colored)

Remove agentx and control socket support.

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@

Revision 1.34 / (download) - annotate - [select for diffs], Mon Dec 9 16:51:10 2019 UTC (4 years, 6 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.33: +3 -1 lines
Diff to previous 1.33 (colored)

Initialize length of uptime and trapoid for trap_agentx.
This probably needs a cleaner approach in the long run, but fixes the
ober_oid_cmp for now.

From gerhard_roth <at> genua <dot> de

Revision 1.32.6.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.32: +17 -17 lines
Diff to previous 1.32 (colored) next main 1.33 (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.33 / (download) - annotate - [select for diffs], Thu Oct 24 12:39:27 2019 UTC (4 years, 7 months ago) by tb
Branch: MAIN
Changes since 1.32: +17 -17 lines
Diff to previous 1.32 (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.32 / (download) - annotate - [select for diffs], Sun Apr 15 11:57:29 2018 UTC (6 years, 1 month ago) by mpf
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4
Branch point for: OPENBSD_6_6
Changes since 1.31: +3 -2 lines
Diff to previous 1.31 (colored)

Add TCP support to snmpd.

This implements RFC 3430, with the exception of processing multiple
incoming requests in parallel (Section 2.1). This required too much
code and is optional anyway.

Initial review by reyk@, very thorough reviews by jca@. Thanks!

OK jca@, gerhard@

Revision 1.31 / (download) - annotate - [select for diffs], Thu Feb 8 18:02:06 2018 UTC (6 years, 4 months ago) by jca
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.30: +1 -2 lines
Diff to previous 1.30 (colored)

Kill ber.c support for direct fd read/writes

This mechanism is already unused and annotated with lots of XXX's, no
need to keep it around.  ok claudio@

Revision 1.30 / (download) - annotate - [select for diffs], Sat Jan 20 18:49:12 2018 UTC (6 years, 4 months ago) by rob
Branch: MAIN
Changes since 1.29: +3 -4 lines
Diff to previous 1.29 (colored)

Fix uninitialized variable.

Ok jca@

Revision 1.29 / (download) - annotate - [select for diffs], Fri Apr 21 13:46:15 2017 UTC (7 years, 1 month ago) by jca
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.28: +2 -1 lines
Diff to previous 1.28 (colored)

Fix uninitialized variable that coult result in a crash.

Fix from Rivo Nurges.

Revision 1.28 / (download) - annotate - [select for diffs], Wed Nov 9 20:31:56 2016 UTC (7 years, 7 months ago) by jca
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.27: +8 -1 lines
Diff to previous 1.27 (colored)

Improve source IP address handling.

- 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@

Revision 1.27 / (download) - annotate - [select for diffs], Fri Oct 28 08:01:53 2016 UTC (7 years, 7 months ago) by rzalamena
Branch: MAIN
Changes since 1.26: +5 -7 lines
Diff to previous 1.26 (colored)

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

ok jca@

Revision 1.26 / (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.25: +2 -3 lines
Diff to previous 1.25 (colored)

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

Revision 1.25 / (download) - annotate - [select for diffs], Sat Nov 21 13:09:47 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.24: +2 -2 lines
Diff to previous 1.24 (colored)

While here, fix two size format string warnings.

Revision 1.24 / (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.23: +1 -2 lines
Diff to previous 1.23 (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.23 / (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.22: +12 -81 lines
Diff to previous 1.22 (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.22 / (download) - annotate - [select for diffs], Mon Apr 14 12:55:10 2014 UTC (10 years, 1 month ago) by blambert
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.21: +139 -124 lines
Diff to previous 1.21 (colored)

Make snmpd use the AgentX protcol for accepting trap requests.
AgentX notifications are the only portion implemented right now;
get in the tree to flesh out the remainder.

ok reyk@ benno@

Revision 1.21 / (download) - annotate - [select for diffs], Sat Oct 19 14:18:39 2013 UTC (10 years, 7 months ago) by blambert
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.20: +3 -2 lines
Diff to previous 1.20 (colored)

Fix receipt of OID varbinds when sending traps

ok reyk@

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

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

commit it deraadt@

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

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

ok gerhard@ blambert@

Revision 1.18 / (download) - annotate - [select for diffs], Wed Sep 11 14:58:01 2013 UTC (10 years, 8 months ago) by blambert
Branch: MAIN
Changes since 1.17: +5 -3 lines
Diff to previous 1.17 (colored)

According to ITU X.690 (ASN.1 definition document), "octet strings"
and derived types are allowed to have 0 content octets, whereas
"bitstrings" are required to have at least 1 content octet. Adjust
the checks in the trap acceptance code to allow for 0-length "octet
strings" in SNMP traps.

okay reyk@

Revision 1.17 / (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_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored)

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

Revision 1.16 / (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.15: +4 -4 lines
Diff to previous 1.15 (colored)

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

ok joel@

Revision 1.15 / (download) - annotate - [select for diffs], Wed Mar 16 15:30:35 2011 UTC (13 years, 2 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.14: +3 -6 lines
Diff to previous 1.14 (colored)

fix trap sending in snmpd by adjusting snmpctl to the imsg libutil
change and fixing the ber element handling in snmpd itself.

tested by jsg@

Revision 1.14 / (download) - annotate - [select for diffs], Sat Jun 6 05:52:01 2009 UTC (15 years ago) by pyr
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.13: +4 -2 lines
Diff to previous 1.13 (colored)

sync snmpd with the common imsg code, making it lib ready as well.
ok eric@

Revision 1.13 / (download) - annotate - [select for diffs], Thu Oct 9 14:14:40 2008 UTC (15 years, 8 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.12: +2 -1 lines
Diff to previous 1.12 (colored)

plug memleak by calling ber_free() after sending a trap to cleanup the
BER write buffer.

Revision 1.12 / (download) - annotate - [select for diffs], Tue Mar 18 16:57:58 2008 UTC (16 years, 2 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.11: +2 -6 lines
Diff to previous 1.11 (colored)

remove ber_add_astring and make it the default behaviour in
ber_add_string, ber_add_nstring, and ber_add_bitstring to allocate and
copy the provided buffer instead of just attaching it to the ber
element.  this may add some overhead but fixes and avoids some bugs
with static buffers and simplifies the ber api again.

From Matthew at Dempsky dot org
With input from claudio@

Revision 1.11 / (download) - annotate - [select for diffs], Fri Feb 8 12:36:47 2008 UTC (16 years, 4 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.10: +3 -2 lines
Diff to previous 1.10 (colored)

use correct variable for COUNTER64

Revision 1.10 / (download) - annotate - [select for diffs], Thu Jan 24 06:36:51 2008 UTC (16 years, 4 months ago) by reyk
Branch: MAIN
Changes since 1.9: +2 -2 lines
Diff to previous 1.9 (colored)

timeticks type

Revision 1.9 / (download) - annotate - [select for diffs], Fri Jan 18 13:04:28 2008 UTC (16 years, 4 months ago) by reyk
Branch: MAIN
Changes since 1.8: +2 -2 lines
Diff to previous 1.8 (colored)

trap.c

Revision 1.8 / (download) - annotate - [select for diffs], Fri Jan 18 02:09:30 2008 UTC (16 years, 4 months ago) by reyk
Branch: MAIN
Changes since 1.7: +0 -0 lines
Diff to previous 1.7 (colored)

add a snmpctl command to send traps to registered receivers using
snmpd's imsg trap interface.

Revision 1.7 / (download) - annotate - [select for diffs], Thu Jan 17 23:36:26 2008 UTC (16 years, 4 months ago) by reyk
Branch: MAIN
Changes since 1.6: +1 -1 lines
Diff to previous 1.6 (colored)

swap arguments

Revision 1.6 / (download) - annotate - [select for diffs], Thu Jan 17 22:55:07 2008 UTC (16 years, 4 months ago) by reyk
Branch: MAIN
Changes since 1.5: +6 -5 lines
Diff to previous 1.5 (colored)

the optional trap varbind elements may be null

Revision 1.5 / (download) - annotate - [select for diffs], Thu Jan 17 17:35:06 2008 UTC (16 years, 4 months ago) by reyk
Branch: MAIN
Changes since 1.4: +21 -6 lines
Diff to previous 1.4 (colored)

allow to configure optional per trap receiver communities and to
restrict the receivers to a specified mib.

Revision 1.4 / (download) - annotate - [select for diffs], Wed Jan 16 21:43:19 2008 UTC (16 years, 4 months ago) by reyk
Branch: MAIN
Changes since 1.3: +69 -39 lines
Diff to previous 1.3 (colored)

send a coldStart trap to registered receivers on startup and cleanup
the trap code a little bit.

Revision 1.3 / (download) - annotate - [select for diffs], Wed Jan 16 19:36:06 2008 UTC (16 years, 4 months ago) by reyk
Branch: MAIN
Changes since 1.2: +81 -20 lines
Diff to previous 1.2 (colored)

implementation of the SNMP trap sender interface

Revision 1.2 / (download) - annotate - [select for diffs], Wed Jan 16 09:45:17 2008 UTC (16 years, 4 months ago) by reyk
Branch: MAIN
Changes since 1.1: +4 -11 lines
Diff to previous 1.1 (colored)

tweak

Revision 1.1 / (download) - annotate - [select for diffs], Wed Jan 16 09:42:29 2008 UTC (16 years, 4 months ago) by reyk
Branch: MAIN

move trap code to an own file; there will be more

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.