OpenBSD CVS

CVS log for src/usr.sbin/relayd/Attic/snmp.c


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.31, Mon Sep 14 11:30:25 2020 UTC (3 years, 8 months ago) by martijn
Branch: MAIN
CVS Tags: HEAD
Changes since 1.30: +1 -1 lines
FILE REMOVED

Rewrite the agentx code of relayd. This new framework should allow us
to add new objects easier if so desired and should handle a lot more
corner-cases.

This commit should also fix the following:
- On most (all) tables it omits the *Entry elements, making it not map to
  OPENBSD-RELAYD-MIB.txt.
- sstolen returns the size of the sockaddr_in{,6}, instead of the
  sin{,6}_addr resulting in garbage data to be put in the ip-field.
- relaydSessionPortIn and relaydSessionPortOut are swapped
- relaydSessions only uses relaydSessionIndex, while
  OPENBSD-RELAYD-MIB.txt says it should have 2 indices
- miscellaneous minor things related to the AGENTX-protocol, like wonky
  index handeling and returning NOSUCHINSTANCE where NOSUCHOBJECT
  should be returned, etc.

This commit does remove traps, but it's large enough as is and I intent
on adding it soon(tm). It also deprecates the snmp keyword in favour of
an agentx keyword. The snmp keyword is still available, but will be
removed in the future.

Tweaks and OK denis@ on the relayd parts
Tweaks and OK claudio@ on the agentx parts
"Get it in" deraadt@

Revision 1.30 / (download) - annotate - [select for diffs], Thu Oct 3 12:03:49 2019 UTC (4 years, 8 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.29: +19 -13 lines
Diff to previous 1.29 (colored)

Make relayd properly return the next element, even if the requested element
doesn't exist in its own structure. This could greatly be improved upon,
but it makes snmp walk on its mib work.

OK claudio@

Revision 1.29 / (download) - annotate - [select for diffs], Sun May 28 10:39:15 2017 UTC (7 years ago) by benno
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.28: +3 -3 lines
Diff to previous 1.28 (colored)

use __func__ in log messages. fix some whitespace while here.
From Hiltjo Posthuma hiltjo -AT codemadness -DOT- org, thanks!
ok florian, claudio

Revision 1.28 / (download) - annotate - [select for diffs], Fri Sep 2 16:14:09 2016 UTC (7 years, 9 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.27: +3 -3 lines
Diff to previous 1.27 (colored)

Move snmp options into struct relayd_config and delay start of the
snmp subsystem until the configuration is done.

OK benno@ claudio@

Revision 1.27 / (download) - annotate - [select for diffs], Fri Sep 2 14:45:51 2016 UTC (7 years, 9 months ago) by reyk
Branch: MAIN
Changes since 1.26: +10 -10 lines
Diff to previous 1.26 (colored)

Split "struct relayd" into two structs: "struct relayd" and "struct
relayd_config".  This way we can send all the relevant global
configuration to the children, not just the flags and the opts.

With input from and
OK claudio@ benno@

Revision 1.26 / (download) - annotate - [select for diffs], Sat Dec 5 10:59:03 2015 UTC (8 years, 6 months ago) by blambert
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.25: +3 -4 lines
Diff to previous 1.25 (colored)

don't attempt to process AgentX packets when a short read is encountered

while here, remove a pair of duplicate function definitions

ok benno@

Revision 1.25 / (download) - annotate - [select for diffs], Wed Dec 2 13:41:27 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.24: +5 -8 lines
Diff to previous 1.24 (colored)

In most cases we don't need all arguments of proc_compose*_imsg(),
so add a shortcut proc_compose*() that skips all of them.  Only use the
full argument list if needed.  The functions with full argument lists can
eventually be replaced with a nicer transaction-based approach later.

OK benno@

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

Use SOCK_NONBLOCK in relayd as well.

OK benno@

Revision 1.23 / (download) - annotate - [select for diffs], Thu Jan 22 17:42:09 2015 UTC (9 years, 4 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.22: +8 -9 lines
Diff to previous 1.22 (colored)

Clean up the relayd headers with help of include-what-you-use and some
manual review.  Based on common practice, relayd.h now includes the
necessary headers for itself.

OK benno@

Revision 1.22 / (download) - annotate - [select for diffs], Thu Jan 22 15:21:05 2015 UTC (9 years, 4 months ago) by reyk
Branch: MAIN
Changes since 1.21: +41 -27 lines
Diff to previous 1.21 (colored)

wrap long lines; spacing.

Repeat after me: "Lines are not longer than 80 characters long" and
"mg(1) is the only true editor, I'll use ESC-q to wrap the lines".

Revision 1.21 / (download) - annotate - [select for diffs], Sun Dec 21 00:54:49 2014 UTC (9 years, 5 months ago) by guenther
Branch: MAIN
Changes since 1.20: +1 -2 lines
Diff to previous 1.20 (colored)

Stop pulling in <arpa/inet.h> or <arpa/nameser.h> when unnecessary.
*Do* pull it in when in_{port,addr}_h is needed and <netinet/in.h> isn't.

ok reyk@

Revision 1.20 / (download) - annotate - [select for diffs], Tue Nov 25 09:17:00 2014 UTC (9 years, 6 months ago) by blambert
Branch: MAIN
Changes since 1.19: +3 -3 lines
Diff to previous 1.19 (colored)

use correct divisor when converting microseconds to 100ths of a second

found by yasuoka@

Revision 1.19 / (download) - annotate - [select for diffs], Mon Nov 24 05:48:25 2014 UTC (9 years, 6 months ago) by jsg
Branch: MAIN
Changes since 1.18: +1 -2 lines
Diff to previous 1.18 (colored)

remove a surplus break statement

Revision 1.18 / (download) - annotate - [select for diffs], Wed Nov 19 10:24:40 2014 UTC (9 years, 6 months ago) by blambert
Branch: MAIN
Changes since 1.17: +1371 -17 lines
Diff to previous 1.17 (colored)

Support exporting relayd statistics via AgentX/snmpd

This should be equivalent to the statistics available
via the various relaydctl show commands

okay benno@ reyk@

Revision 1.17 / (download) - annotate - [select for diffs], Wed Jun 25 11:05:15 2014 UTC (9 years, 11 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored)

sync copyright to reality according to my last changes

Revision 1.16 / (download) - annotate - [select for diffs], Wed Apr 23 15:45:16 2014 UTC (10 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.15: +2 -2 lines
Diff to previous 1.15 (colored)

Fix format string in DEBUG message (not compiled by default).

ok blambert@

Revision 1.15 / (download) - annotate - [select for diffs], Sun Apr 20 16:23:33 2014 UTC (10 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.14: +4 -2 lines
Diff to previous 1.14 (colored)

Check another strlcpy overflow that is very unlikely to happen.

Revision 1.14 / (download) - annotate - [select for diffs], Mon Apr 14 12:58:04 2014 UTC (10 years, 1 month ago) by blambert
Branch: MAIN
Changes since 1.13: +217 -87 lines
Diff to previous 1.13 (colored)

Adapt relayd to use AgentX protocol to send traps

ok reyk@ benno@

Revision 1.13 / (download) - annotate - [select for diffs], Thu Jan 17 20:34:18 2013 UTC (11 years, 4 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.12: +3 -3 lines
Diff to previous 1.12 (colored)

Remove unnecessary pointer casts.  No binary diff.
OK benno@

Revision 1.12 / (download) - annotate - [select for diffs], Wed Feb 1 19:24:46 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.11: +11 -11 lines
Diff to previous 1.11 (colored)

Append mandatory instance identifier (.0 for scalars), so other SNMP
implementations can grok it.

ok joel@

Revision 1.11 / (download) - annotate - [select for diffs], Thu May 19 08:56:49 2011 UTC (13 years ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.10: +32 -60 lines
Diff to previous 1.10 (colored)

Fix reload support in relayd(8) by reimplementing large parts of the
daemon infrastructure. The previous design made it fairly hard to
reload the complex data structures, especially relays and protocols.
One of the reasons was that the privsep'd relayd processes had two
ways of getting their configuration: 1) from memory after forking from
the parent process and 2) and (partially) via imsgs after reload.  The
new implementation first forks the privsep'd children before the
parents loads the configuration and sends it via imsgs to them; so it
is only like 2) before.  It is based on an approach that I first
implemented for iked(8) and I also fixed many bugs in the code.

Thanks to many testers including dlg@ sthen@ phessler@
ok pyr@ dlg@ sthen@

Revision 1.10 / (download) - annotate - [select for diffs], Mon May 9 12:08:47 2011 UTC (13 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.9: +26 -28 lines
Diff to previous 1.9 (colored)

Reorganize the relayd code to use the proc.c privsep API/commodity
functions that are based on work for iked and smtpd.  This simplifies
the setup of privsep processes and moves some redundant and repeated
code to a single place - which is always good from a quality and
security point of view.  The relayd version of proc.c is different to
the current version in iked because it uses 1:N communications between
processes, eg. a single parent process is talking to many forked relay
children while iked only needs 1:1 communications.

ok sthen@ pyr@

Revision 1.9 / (download) - annotate - [select for diffs], Thu May 5 12:01:44 2011 UTC (13 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.8: +5 -5 lines
Diff to previous 1.8 (colored)

Update all logging and debug functions to use the __func__ macro
instead of static function names.  __func__ is C99 and perfectly fine
to use. It also avoids printing errors; for example if a statement
log_debug("foo:"..) was moved or copied from function foo() to bar()
and the log message was not updated...

Revision 1.8 / (download) - annotate - [select for diffs], Tue Jun 9 16:26:03 2009 UTC (15 years ago) by deraadt
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.7: +2 -1 lines
Diff to previous 1.7 (colored)

missing header file; bring things into scope

Revision 1.7 / (download) - annotate - [select for diffs], Sun Jun 7 05:56:25 2009 UTC (15 years ago) by eric
Branch: MAIN
Changes since 1.6: +2 -2 lines
Diff to previous 1.6 (colored)

Change the way fds passed over a socket are retreived on the receiving side.

Currently the receiver fetches an imsg via imsg_get() and if he expects
an fd, he then calls imsg_get_fd() to fetch the next fd queued on the
imsgbuf from which the imsg came.

This changes hides the fd queueing mechanism to the API user.  When closing
an imsg with an fd, the message is flagged so that the receiving end knows
it must dequeue the fd in imsg_get() and return it with the imsg structure.
This way there is no (less) possible screw up from imsg_get_fd() not being
called directly after imsg_get() by the user. The retreived imsg is
self-contained.

ok pyr@, "I like that" henning@

Revision 1.6 / (download) - annotate - [select for diffs], Sat Jun 6 05:30:45 2009 UTC (15 years ago) by eric
Branch: MAIN
Changes since 1.5: +2 -2 lines
Diff to previous 1.5 (colored)

allocate the correct amount of memory

ok pyr@

Revision 1.5 / (download) - annotate - [select for diffs], Fri Jun 5 23:39:51 2009 UTC (15 years ago) by pyr
Branch: MAIN
Changes since 1.4: +30 -30 lines
Diff to previous 1.4 (colored)

4 handed diff with eric:
Stop pushing event handling in the imsg framework.
Instead, provide a small glue layer on top of both imsg and libevent.
This finally clearly separates event handling and imsg construction.

Sidetrack bonus: remove the mega-ugly hack of having a dummy imsg_event_add
stub in relayctl.

This will make bgpd (and thus henning) happy. Next up are smtpd and ospfd.

ok eric@

Revision 1.4 / (download) - annotate - [select for diffs], Fri Jun 5 00:04:01 2009 UTC (15 years ago) by pyr
Branch: MAIN
Changes since 1.3: +8 -7 lines
Diff to previous 1.3 (colored)

Make imsg completely async model agnostic by not requiring an
imsg_event_add function to be provided (which ended up being a named
callback).
Instead provide a wrapper in the daemon and call that everywhere.
Previsously discussed with the usual suspects,
ok eric@ though not too happy about the function name
(imsg_compose_event).

Revision 1.3 / (download) - annotate - [select for diffs], Wed Jun 3 20:20:09 2009 UTC (15 years ago) by eric
Branch: MAIN
Changes since 1.2: +2 -3 lines
Diff to previous 1.2 (colored)

cleanup contorted and slightly broken call to imsg_get_fd

ok pyr@

Revision 1.2 / (download) - annotate - [select for diffs], Mon May 5 15:07:12 2008 UTC (16 years, 1 month ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.1: +4 -4 lines
Diff to previous 1.1 (colored)

clean up after reyk (tab at EOL)

Revision 1.1 / (download) - annotate - [select for diffs], Mon Feb 11 10:42:50 2008 UTC (16 years, 4 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3

Marry relayd with snmpd using new "send trap" option: Request to send
a SNMP trap when the state of a host changes.  relayd(8) will try to
(re-)connect to snmpd(8) and request it to send a trap to the
registered trap receivers, see snmpd.conf(5) for more information
about the configuration.

ok pyr@ thib@

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.