Virgin import of bsnmpd 1.8

This commit is contained in:
Hartmut Brandt 2005-02-28 17:27:11 +00:00
parent e0fd476003
commit 94caccb357
20 changed files with 136 additions and 79 deletions

View File

@ -1,3 +1,16 @@
1.8
many man page fixes from ru@freebsd.org and tobez@freebsd.org
snmpd/main.c: fix a problem which resulted in the daemon exiting
when a local socket was closed.
snmpd/trans_lsock.c: include stdio.h to get a prototype for remove.
gensnmptree/gensnmptree.c: fix a compile error
1.7a
fix core dump when config file cannot be opened (submitted by
Maxim Konovalov)
1.7
snmpd: Move event library initialisation before reading of
config file (thanks to phk).

View File

@ -1 +1 @@
1.7
1.8

View File

@ -26,10 +26,10 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Begemot: bsnmp/gensnmpdef/gensnmpdef.1,v 1.2 2004/08/06 08:46:44 brandt Exp $
.\" $Begemot: bsnmp/gensnmpdef/gensnmpdef.1,v 1.3 2005/02/25 11:55:54 brandt_h Exp $
.\"
.Dd April 14, 2004
.Dt gensnmpdef 1
.Dt GENSNMPDEF 1
.Os
.Sh NAME
.Nm gensnmpdef

View File

@ -26,10 +26,10 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Begemot: bsnmp/gensnmptree/gensnmptree.1,v 1.3 2004/08/06 08:46:46 brandt Exp $
.\" $Begemot: bsnmp/gensnmptree/gensnmptree.1,v 1.4 2005/02/25 11:55:56 brandt_h Exp $
.\"
.Dd October 7, 2003
.Dt gensnmptree 1
.Dt GENSNMPTREE 1
.Os
.Sh NAME
.Nm gensnmptree

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Begemot: bsnmp/gensnmptree/gensnmptree.c,v 1.38 2004/08/06 08:46:46 brandt Exp $
* $Begemot: bsnmp/gensnmptree/gensnmptree.c,v 1.41 2005/02/25 11:51:12 brandt_h Exp $
*
* Generate OID table from table description.
*
@ -50,7 +50,7 @@
*
* elements := EMPTY | elements element
*
* element := tree | leaf
* element := tree | leaf | column
*
* index := TYPE | index TYPE
*
@ -560,9 +560,12 @@ gen_header(struct node *np, u_int oidlen, const char *func)
if((np->flags & (FL_GET|FL_SET)) == 0)
return;
if (np->type == NODE_COLUMN)
if (np->type == NODE_COLUMN) {
if (func == NULL)
errx(1, "column without function (%s) - probably "
"outside of a table", np->name);
sprintf(f, "%s", func);
else
} else
sprintf(f, "%s", np->u.leaf.func);
LIST_FOREACH(ptr, &funcs, link)

View File

@ -26,10 +26,10 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Begemot: bsnmp/lib/asn1.3,v 1.5 2004/08/06 08:46:48 brandt Exp $
.\" $Begemot: bsnmp/lib/asn1.3,v 1.6 2005/02/25 11:55:57 brandt_h Exp $
.\"
.Dd August 15, 2002
.Dt asn1 3
.Dt ASN1 3
.Os
.Sh NAME
.Nm asn_get_header ,
@ -468,11 +468,11 @@ starting with
.Sq ASN.1:
followed by the error message and an optional dump of the buffer.
.Sh SEE ALSO
.Xr snmpd 1 ,
.Xr gensnmptree 1 ,
.Xr bsnmplib 3
.Xr snmpd 1 ,
.Xr bsnmpagent 3 ,
.Xr bsnmpclient 3 ,
.Xr bsnmpagent 3
.Xr bsnmplib 3
.Sh STANDARDS
This implementation conforms to the applicable IETF RFCs and ITU-T
recommendations.

View File

@ -26,13 +26,13 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Begemot: bsnmp/lib/bsnmpagent.3,v 1.6 2004/08/06 08:46:51 brandt Exp $
.\" $Begemot: bsnmp/lib/bsnmpagent.3,v 1.7 2005/02/25 11:55:58 brandt_h Exp $
.\"
.Dd August 16, 2002
.Dt bsnmpagent 3
.Dt BSNMPAGENT 3
.Os
.Sh NAME
.Nm bsnmpagent
.Nm bsnmpagent ,
.Nm snmp_depop_t ,
.Nm snmp_op_t ,
.Nm tree ,
@ -399,10 +399,10 @@ If an error occures in any of the function an error indication as described
above is returned. Additionally the functions may call snmp_error on unexected
errors.
.Sh SEE ALSO
.Xr snmpd 1 ,
.Xr gensnmptree 1 ,
.Xr bsnmplib 3
.Xr snmpd 1 ,
.Xr bsnmpclient 3 ,
.Xr bsnmplib 3 ,
.Xr snmpmod 3
.Sh STANDARDS
This implementation conforms to the applicable IETF RFCs and ITU-T

View File

@ -26,10 +26,10 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Begemot: bsnmp/lib/bsnmpclient.3,v 1.7 2004/08/06 08:46:52 brandt Exp $
.\" $Begemot: bsnmp/lib/bsnmpclient.3,v 1.8 2005/02/25 11:55:58 brandt_h Exp $
.\"
.Dd August 15, 2002
.Dt bsnmpclient 3
.Dt BSNMPCLIENT 3
.Os
.Sh NAME
.Nm snmp_client ,
@ -237,9 +237,8 @@ application.
.El
.Pp
In the current implementation there is a global variable
.Bd -unfilled -offset indent
.Vt extern struct snmp_client snmp_client ;
.Ed
.Pp
.D1 Vt extern struct snmp_client snmp_client ;
.Pp
that is used by all the library functions. The first call into the library must
be a call to
@ -580,10 +579,10 @@ in the
filed of
.Va snmp_client .
.Sh SEE ALSO
.Xr snmpd 1 ,
.Xr gensnmptree 1 ,
.Xr snmpd 1 ,
.Xr bsnmpagent 3 ,
.Xr bsnmplib 3
.Xr bsnmpagent 3
.Sh STANDARDS
This implementation conforms to the applicable IETF RFCs and ITU-T
recommendations.

View File

@ -26,10 +26,10 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Begemot: bsnmp/lib/bsnmplib.3,v 1.5 2004/08/06 08:46:52 brandt Exp $
.\" $Begemot: bsnmp/lib/bsnmplib.3,v 1.6 2005/02/25 11:55:59 brandt_h Exp $
.\"
.Dd August 15, 2002
.Dt bsnmplib 3
.Dt BSNMPLIB 3
.Os
.Sh NAME
.Nm snmp_value_free ,
@ -290,11 +290,11 @@ Success.
Encoding failed.
.El
.Sh SEE ALSO
.Xr snmpd 1 ,
.Xr gensnmptree 1 ,
.Xr bsnmplib 3
.Xr snmpd 1 ,
.Xr bsnmpagent 3 ,
.Xr bsnmpclient 3 ,
.Xr bsnmpagent 3
.Xr bsnmplib 3
.Sh STANDARDS
This implementation conforms to the applicable IETF RFCs and ITU-T
recommendations.

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Begemot: bsnmp/lib/snmpagent.c,v 1.18 2004/08/06 08:46:55 brandt Exp $
* $Begemot: bsnmp/lib/snmpagent.c,v 1.19 2004/08/19 17:09:09 brandt Exp $
*
* SNMP Agent functions
*/
@ -339,6 +339,11 @@ do_getnext(struct context *context, const struct snmp_value *inb,
/* object has no data - try next */
if (++tp == tree + tree_size)
break;
if (TR(GETNEXT))
snmp_debug("getnext: no data - avancing to %s",
asn_oid2str(&tp->oid));
outb->var = tp->oid;
}

21
contrib/bsnmp/oid-list Normal file
View File

@ -0,0 +1,21 @@
$Begemot: bsnmp/oid-list,v 1.1 2005/02/25 12:21:00 brandt_h Exp $
This file documents the OID assignments under BSNMP's private OID.
While I was at Fraunhofer Fokus (www.fokus.fraunhofer.de) I registered
an official OID for Fokus: enterprises 12325 and assigned the sub-OID 1
to the software I develop. Under this OID there are:
enterprises
12325 FOKUS
1 BEGEMOT
1 BEGEMOT-SNMPD
2 BEGEMOT-NETGRAPH snmpd netgraph module
100 BEGEMOT-ILMID snmpd ILMID module
101 BEGEMOT-ATM snmpd ATM module
200 BEGEMOT-PF snmpd PF module (phillip@freebsd.org)
If you need an OID and don't know where to stuck it in, I can assign you one -
just drop me a mail.
harti

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Begemot: bsnmp/snmp_mibII/mibII.c,v 1.20 2004/08/06 08:46:59 brandt Exp $
* $Begemot: bsnmp/snmp_mibII/mibII.c,v 1.21 2005/02/25 16:04:41 brandt_h Exp $
*
* Implementation of the standard interfaces and ip MIB.
*/
@ -590,6 +590,7 @@ mibif_create(u_int sysindex, const char *name)
ifp->sysindex = sysindex;
strcpy(ifp->name, name);
strcpy(ifp->descr, name);
ifp->spec_oid = oid_zeroDotZero;
map = NULL;
if (!mib_if_is_dyn(ifp->name)) {

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Begemot: bsnmp/snmp_mibII/mibII_interfaces.c,v 1.13 2004/08/06 08:47:01 brandt Exp $
* $Begemot: bsnmp/snmp_mibII/mibII_interfaces.c,v 1.14 2005/02/25 16:04:42 brandt_h Exp $
*
* Interfaces group.
*/
@ -336,7 +336,7 @@ op_ifentry(struct snmp_context *ctx, struct snmp_value *value,
break;
case LEAF_ifSpecific:
value->v.oid = oid_zeroDotZero;
value->v.oid = ifp->spec_oid;
break;
}
return (SNMP_ERR_NOERROR);

View File

@ -26,10 +26,10 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Begemot: bsnmp/snmp_mibII/snmp_mibII.3,v 1.4 2004/08/06 08:47:06 brandt Exp $
.\" $Begemot: bsnmp/snmp_mibII/snmp_mibII.3,v 1.6 2005/02/28 16:00:11 brandt_h Exp $
.\"
.Dd August 19, 2002
.Dt snmp_mibII 3
.Dt SNMP_MIBII 3
.Os
.Sh NAME
.Nm mibII ,
@ -151,6 +151,7 @@ struct mibif {
mibif_notify_f xnotify;
void *xnotify_data;
const struct lmodule *xnotify_mod;
struct asn_oid spec_oid;
};
.Ed
.Pp
@ -337,9 +338,10 @@ The description of the MIB tree implemented by
.It Pa /usr/local/share/snmp/mibs
.It Pa @MIBSPATH@
The various internet MIBs.
.El
.Sh SEE ALSO
.Xr snmpmod 3 ,
.Xr gensnmptree 1
.Xr gensnmptree 1 ,
.Xr snmpmod 3
.Sh STANDARDS
This implementation conforms to the applicable IETF RFCs.
.Sh AUTHORS

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Begemot: bsnmp/snmp_mibII/snmp_mibII.h,v 1.15 2004/08/06 08:47:06 brandt Exp $
* $Begemot: bsnmp/snmp_mibII/snmp_mibII.h,v 1.16 2005/02/25 16:04:43 brandt_h Exp $
*
* Implementation of the interfaces and IP groups of MIB-II.
*/
@ -76,6 +76,9 @@ struct mibif {
mibif_notify_f xnotify;
void *xnotify_data;
const struct lmodule *xnotify_mod;
/* to be set by ifType specific modules. This is ifSpecific. */
struct asn_oid spec_oid;
};
/*

View File

@ -26,7 +26,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Begemot: bsnmp/snmpd/bsnmpd.1,v 1.4 2004/08/06 08:47:10 brandt Exp $
.\" $Begemot: bsnmp/snmpd/bsnmpd.1,v 1.6 2005/02/25 11:56:01 brandt_h Exp $
.\"
.Dd August 15, 2002
.Dt SNMPD 1
@ -47,7 +47,7 @@
The
.Nm
daemon servers the internet SNMP (Simple Network Managment Protocol).
It is intended to server only the absolute basic MIBs and implement all other
It is intended to serve only the absolute basic MIBs and implement all other
MIBs through loadable modules. In this way the
.Nm
can be used in unexpected ways.
@ -84,7 +84,7 @@ value. The value can be specified in the usual C-syntax for numbers.
This option specifies a colon separated list of directories to search for
configuration include files. The default is
.Pa /etc:/usr/etc/:/usr/local/etc .
These paths are only searched for include specified within <> parantheses.
These paths are only searched for include specified within <> parentheses.
.It Fl l Ar prefix
The
.Ar prefix
@ -112,7 +112,7 @@ MIB variable assignments
.El
.Pp
If a line is too long it can be continued on the next line by ending it with
a backslash. Empty lines and lines who's first non-blank character is a
a backslash. Empty lines and lines in which the first non-blank character is a
.Dq #
sign are ignored.
.Pp
@ -123,7 +123,7 @@ in a single SET PDU. Any failure during the initial configuration read causes
to exit. A failure during the configuration read caused by a module load
causes the loading of the module to fail.
.Pp
The configuration is red during initialisation of
The configuration is read during initialisation of
.Nm ,
when a module is loaded and when
.Nm
@ -177,7 +177,7 @@ include directive that takes one of two forms:
.Pp
The first form causes the file to be searched in the current directory, the
second form causes the file to be searched in the directories specified in
the system include path. Nesting depths is only restricted by available
the system include path. Nesting depth is only restricted by available
memory.
.Ss MIB VARIABLE ASSIGNMENTS
A MIB variable is assigned with the syntax
@ -189,8 +189,8 @@ oid [ suboids ] = value
is the name of the variable to be set. Only the last component of the entire
name is used here. If the variable is a scalar, the index (.0) is automatically
appended and need not to be specified. If the variable is a table column,
the index (
.Va suboids )
the index
.Pq Va suboids
must be specified. The index consist of elements each seperated from the
previous one by a dot. Elements may be either numbers, strings or hostnames
enclosed in [] brackets. If the element is a number it is appended

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Begemot: bsnmp/snmpd/main.c,v 1.89 2004/08/06 08:47:11 brandt Exp $
* $Begemot: bsnmp/snmpd/main.c,v 1.90 2005/02/25 11:50:03 brandt_h Exp $
*
* SNMPd main stuff.
*/
@ -612,7 +612,7 @@ fd_resume(void *p)
#ifdef USE_LIBBEGEMOT
if (f->id >= 0)
return (0);
if ((f->fd = poll_register(f->fd, input, f, POLL_IN)) < 0) {
if ((f->id = poll_register(f->fd, input, f, POLL_IN)) < 0) {
err = errno;
syslog(LOG_ERR, "select fd %d: %m", f->fd);
errno = err;

View File

@ -26,7 +26,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $Begemot: bsnmp/snmpd/snmpd.config,v 1.14 2004/08/06 08:47:12 brandt Exp $
# $Begemot: bsnmp/snmpd/snmpd.config,v 1.15 2005/02/25 11:50:43 brandt_h Exp $
#
# Example configuration file.
#
@ -62,6 +62,7 @@ begemotSnmpdPortStatus.127.0.0.1.161 = 1
# open a unix domain socket
begemotSnmpdLocalPortStatus."/var/run/snmpd.sock" = 1
begemotSnmpdLocalPortType."/var/run/snmpd.sock" = 4
# send traps to the traphost
begemotTrapSinkStatus.[$(traphost)].$(trapport) = 4

View File

@ -26,10 +26,10 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Begemot: bsnmp/snmpd/snmpmod.3,v 1.7 2004/08/06 08:47:14 brandt Exp $
.\" $Begemot: bsnmp/snmpd/snmpmod.3,v 1.8 2005/02/25 11:56:01 brandt_h Exp $
.\"
.Dd August 16, 2002
.Dt snmpmod 3
.Dt SNMPMOD 3
.Os
.Sh NAME
.Nm INSERT_OBJECT_OID_LINK_INDEX ,
@ -161,18 +161,26 @@ Begemot SNMP library
.Ft size_t
.Fn buf_size "int tx"
.Ft enum snmpd_input_err
.Fn snmp_input_start "const u_char *buf" "size_t len" "const char *source" \
"struct snmp_pdu *pdu" "int32_t *ip" "size_t *pdulen"
.Fo snmp_input_start
.Fa "const u_char *buf" "size_t len" "const char *source"
.Fa "struct snmp_pdu *pdu" "int32_t *ip" "size_t *pdulen"
.Fc
.Ft enum snmpd_input_err
.Fn snmp_input_finish "struct snmp_pdu *pdu" "const u_char *rcvbuf" \
"size_t rcvlen" "u_char *sndbuf" "size_t *sndlen" "const char *source" \
"enum snmpd_input_err ierr" "int32_t ip" "void *data"
.Fo snmp_input_finish
.Fa "struct snmp_pdu *pdu" "const u_char *rcvbuf"
.Fa "size_t rcvlen" "u_char *sndbuf" "size_t *sndlen" "const char *source"
.Fa "enum snmpd_input_err ierr" "int32_t ip" "void *data"
.Fc
.Ft void
.Fn snmp_output "struct snmp_pdu *pdu" "u_char *sndbuf" "size_t *sndlen" \
"const char *dest"
.Fo snmp_output
.Fa "struct snmp_pdu *pdu" "u_char *sndbuf" "size_t *sndlen"
.Fa "const char *dest"
.Fc
.Ft void
.Fn snmp_send_port "void *trans" "const struct asn_oid *port" \
"struct snmp_pdu *pdu" "const struct sockaddr *addr" "socklen_t addrlen"
.Fo snmp_send_port
.Fa "void *trans" "const struct asn_oid *port"
.Fa "struct snmp_pdu *pdu" "const struct sockaddr *addr" "socklen_t addrlen"
.Fc
.Ft void
.Fn snmp_send_trap "const struct asn_oid *oid" "..."
.Ft int
@ -851,11 +859,11 @@ beginning at position
.Fa off .
.El
.Sh SEE ALSO
.Xr snmpd 1 ,
.Xr gensnmptree 1 ,
.Xr bsnmplib 3
.Xr snmpd 1 ,
.Xr bsnmpagent 3 ,
.Xr bsnmpclient 3 ,
.Xr bsnmpagent 3
.Xr bsnmplib 3
.Sh STANDARDS
This implementation conforms to the applicable IETF RFCs and ITU-T
recommendations.

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Begemot: bsnmp/snmpd/trans_lsock.c,v 1.5 2004/08/06 08:47:15 brandt Exp $
* $Begemot: bsnmp/snmpd/trans_lsock.c,v 1.6 2005/02/25 11:50:25 brandt_h Exp $
*
* Local domain socket transport
*/
@ -34,6 +34,7 @@
#include <sys/un.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <syslog.h>