diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2008-01-16 09:36:31 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2008-01-16 09:36:31 +0000 |
commit | 031fa3c3eee7859e08bdb17182579db193dfa644 (patch) | |
tree | da5632fb4421d1fca08ab173b8f2e1f5abaad0a5 /usr.sbin/snmpd/control.c | |
parent | a25938ad144a024f282fec3159fc8af9f5d79263 (diff) |
start working on an interface to send traps via snmpd.sock. userland
applications will be able to send imsgs defining the trap to snmpd and
the daemon will do the ASN.1/BER encoding before sending traps to the
registered receivers. there are two advantages of this approach that
a) the applications do not need to handle any ASN.1/BER encoding and
b) snmpd will provide a central interface to define trap receivers.
discussed with thib and others
Diffstat (limited to 'usr.sbin/snmpd/control.c')
-rw-r--r-- | usr.sbin/snmpd/control.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.sbin/snmpd/control.c b/usr.sbin/snmpd/control.c index 24023e798c5..a048f652fa5 100644 --- a/usr.sbin/snmpd/control.c +++ b/usr.sbin/snmpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.1 2007/12/05 09:22:44 reyk Exp $ */ +/* $OpenBSD: control.c,v 1.2 2008/01/16 09:36:30 reyk Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -230,6 +230,16 @@ control_dispatch_imsg(int fd, short event, void *arg) } c->flags |= CTL_CONN_NOTIFY; break; + case IMSG_SNMP_TRAP: + if (snmpe_trap(&c->ibuf, imsg.hdr.pid) == -1) { + log_debug("control_dispatch_imsg: " + "received invalid trap (pid %d)", + imsg.hdr.pid); + imsg_free(&imsg); + control_close(fd); + return; + } + break; default: log_debug("control_dispatch_imsg: " "error handling imsg %d", imsg.hdr.type); |