Sync bsnmpd with HEAD.
Approved by: re (scottl) Approved by: harti
This commit is contained in:
parent
a6d8ed18f8
commit
0a0cd568a9
@ -10,5 +10,7 @@
|
||||
*/gensnmptree/Makefile.in
|
||||
*/lib/Makefile.in
|
||||
*/snmp_mibII/Makefile.in
|
||||
*/snmp_mibII/tree.h
|
||||
*/snmp_ntp/Makefile.in
|
||||
*/snmpd/Makefile.in
|
||||
*/snmpd/.gdbinit
|
||||
|
@ -1,3 +1,29 @@
|
||||
1.12
|
||||
A couple of man page fixes from various submitters.
|
||||
|
||||
Make default communities NULL for security.
|
||||
|
||||
Fix a core dump when -d tracing suboption has no argument (thanks
|
||||
to Shteryana Shopova).
|
||||
|
||||
Fix bug in parsing the include path in the daemon.
|
||||
|
||||
Fix an uninitialize structure field in gensnmptree (thanks to
|
||||
jasone@freebsdorg)
|
||||
|
||||
64bit HC counters in the IF-MIB by polling the OS periodically.
|
||||
|
||||
Fix link traps to be more RFC conform (thanks to glebius@freebsd.org)
|
||||
|
||||
Add fallback definition for SA_SIZE() to support.h.
|
||||
|
||||
Move the porting definitions for U?INT32_{MIN,MAX} into support.h.
|
||||
|
||||
Include a sys/tree.h from FreeBSD-current and add autoconf
|
||||
check for it.
|
||||
|
||||
1.11a Fix build of modules when stdint.h is included after asn1.h
|
||||
|
||||
1.11 Make the Mib2 routing table use red-black tree. This vastly
|
||||
reduces loading and access time. Load the table only every 10
|
||||
minutes. In the meantime process message from the routing socket
|
||||
|
@ -1,6 +1,3 @@
|
||||
snmpd_mibII:
|
||||
- handle HC counters by periodically polling the kernel counters.
|
||||
|
||||
snmpd:
|
||||
- rethink transports a little bit: make them loadable and make
|
||||
a private subtree for transports:
|
||||
|
@ -1 +1 @@
|
||||
1.11
|
||||
1.12
|
||||
|
@ -26,9 +26,9 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $Begemot: bsnmp/gensnmptree/gensnmptree.1,v 1.5 2005/06/15 11:31:25 brandt_h Exp $
|
||||
.\" $Begemot: bsnmp/gensnmptree/gensnmptree.1,v 1.7 2006/02/27 09:52:08 brandt_h Exp $
|
||||
.\"
|
||||
.Dd June 14, 2005
|
||||
.Dd February 27, 2006
|
||||
.Dt GENSNMPTREE 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -45,7 +45,7 @@ The
|
||||
utility is used to either generate C language tables and header files from
|
||||
a MIB description or to numeric OIDs from MIB descriptions.
|
||||
The first form is used only for maintaining the
|
||||
.Xr snmpd 1
|
||||
.Xr bsnmpd 1
|
||||
daemon or for module writers.
|
||||
The second form may be used by SNMP client program writers.
|
||||
.Pp
|
||||
@ -57,7 +57,7 @@ reads a MIB description from its standard input and creates two files: a
|
||||
C-file
|
||||
.Ar prefix Ns tree.c
|
||||
containing a table used by
|
||||
.Xr snmpd 1
|
||||
.Xr bsnmpd 1
|
||||
during PDU processing
|
||||
and a header file
|
||||
.Ar prefix Ns tree.h
|
||||
@ -70,14 +70,19 @@ option is specified
|
||||
.Nm
|
||||
expects MIB variable names (only the last component) on its command line.
|
||||
It reads a MIB specification from standard input and for each MIB variable
|
||||
name emits two C preprocessor defines on its standard output.
|
||||
One define
|
||||
.Va OID_ Ns Ar name
|
||||
can be used as an array initialized to initialize a
|
||||
.Va struct asn_oid .
|
||||
The other define
|
||||
.Va OIDLEN_ Ns Ar name
|
||||
contains the length of the OID.
|
||||
name emits three C preprocessor defines on its standard output:
|
||||
.Bl -tag -width ".Va OIDLEN_ Ns Ar Name"
|
||||
.It Va OIDX_ Ns Ar name
|
||||
This define can be used to initialize a
|
||||
.Va struct asn_oid
|
||||
in the following way:
|
||||
.Pp
|
||||
.Dl const struct asn_oid oid_sysDescr = OIDX_sysDescr;
|
||||
.It Va OIDLEN_ Ns Ar name
|
||||
is the length of the OID.
|
||||
.It Va OID_ Ns Ar name
|
||||
is the last component of the OID.
|
||||
.El
|
||||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width ".Fl d Ar argument"
|
||||
@ -88,7 +93,7 @@ Enter extract mode.
|
||||
.It Fl l
|
||||
Generate local preprocessor includes.
|
||||
This is used for bootstrapping
|
||||
.Xr snmpd 1 .
|
||||
.Xr bsnmpd 1 .
|
||||
.It Fl t
|
||||
Instead of normal output print the resulting tree.
|
||||
.It Fl p Ar prefix
|
||||
@ -187,6 +192,6 @@ The following MIB description describes the system group:
|
||||
)
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr snmpd 1
|
||||
.Xr bsnmpd 1
|
||||
.Sh AUTHORS
|
||||
.An Hartmut Brandt Aq harti@freebsd.org
|
||||
|
@ -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.43 2005/10/04 11:21:29 brandt_h Exp $
|
||||
* $Begemot: bsnmp/gensnmptree/gensnmptree.c,v 1.44 2006/02/14 09:04:17 brandt_h Exp $
|
||||
*
|
||||
* Generate OID table from table description.
|
||||
*
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Begemot: bsnmp/lib/asn1.c,v 1.29 2005/10/04 11:21:31 brandt_h Exp $
|
||||
* $Begemot: bsnmp/lib/asn1.c,v 1.31 2005/10/06 07:14:58 brandt_h Exp $
|
||||
*
|
||||
* ASN.1 for SNMP.
|
||||
*/
|
||||
@ -41,6 +41,8 @@
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#include "support.h"
|
||||
#include "asn1.h"
|
||||
|
||||
#if !defined(INT32_MIN)
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Begemot: bsnmp/lib/asn1.h,v 1.19 2005/10/04 11:21:31 brandt_h Exp $
|
||||
* $Begemot: bsnmp/lib/asn1.h,v 1.20 2005/10/05 16:43:11 brandt_h Exp $
|
||||
*
|
||||
* ASN.1 for SNMP
|
||||
*/
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Begemot: bsnmp/lib/snmpclient.c,v 1.34 2005/10/04 14:32:42 brandt_h Exp $
|
||||
* $Begemot: bsnmp/lib/snmpclient.c,v 1.36 2005/10/06 07:14:58 brandt_h Exp $
|
||||
*
|
||||
* Support functions for SNMP clients.
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2004
|
||||
* Copyright (C) 2004-2005
|
||||
* Hartmut Brandt.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Begemot: bsnmp/lib/support.h,v 1.1 2004/08/06 08:47:59 brandt Exp $
|
||||
* $Begemot: bsnmp/lib/support.h,v 1.2 2005/10/06 07:14:59 brandt_h Exp $
|
||||
*
|
||||
* Functions that are missing on certain systems. This header file is not
|
||||
* to be installed.
|
||||
@ -68,4 +68,29 @@ void freeaddrinfo(struct addrinfo *);
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* For systems with missing stdint.h or inttypes.h
|
||||
*/
|
||||
#if !defined(INT32_MIN)
|
||||
#define INT32_MIN (-0x7fffffff-1)
|
||||
#endif
|
||||
#if !defined(INT32_MAX)
|
||||
#define INT32_MAX (0x7fffffff)
|
||||
#endif
|
||||
#if !defined(UINT32_MAX)
|
||||
#define UINT32_MAX (0xffffffff)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Systems missing SA_SIZE(). Taken from FreeBSD net/route.h:1.63
|
||||
*/
|
||||
#ifndef SA_SIZE
|
||||
|
||||
#define SA_SIZE(sa) \
|
||||
( (!(sa) || ((struct sockaddr *)(sa))->sa_len == 0) ? \
|
||||
sizeof(long) : \
|
||||
1 + ( (((struct sockaddr *)(sa))->sa_len - 1) | (sizeof(long) - 1) ) )
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
$Begemot: bsnmp/oid-list,v 1.3 2005/05/23 09:03:22 brandt_h Exp $
|
||||
$Begemot: bsnmp/oid-list,v 1.5 2006/02/27 09:55:45 brandt_h Exp $
|
||||
|
||||
This file documents the OID assignments under BSNMP's private OID.
|
||||
|
||||
@ -11,10 +11,12 @@ enterprises
|
||||
1 BEGEMOT
|
||||
1 BEGEMOT-SNMPD
|
||||
2 BEGEMOT-NETGRAPH snmpd netgraph module
|
||||
3 BEGEMOT-IP snmpd IP related stuff.
|
||||
100 BEGEMOT-ILMID snmpd ILMID module
|
||||
101 BEGEMOT-ATM snmpd ATM module
|
||||
200 BEGEMOT-PF snmpd PF module (phillip@freebsd.org)
|
||||
201 BEGEMOT-NTP snmpd NTP module
|
||||
202 BEGEMOT-HOSTRES snmpd HOSTRES module private stuff
|
||||
300 BEGEMOT-ACM DLR ACM project
|
||||
|
||||
If you need an OID and don't know where to stuck it in, I can assign you one -
|
||||
|
@ -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.23 2005/06/09 12:36:52 brandt_h Exp $
|
||||
* $Begemot: bsnmp/snmp_mibII/mibII.c,v 1.24 2006/02/14 09:04:18 brandt_h Exp $
|
||||
*
|
||||
* Implementation of the standard interfaces and ip MIB.
|
||||
*/
|
||||
@ -105,6 +105,18 @@ struct clockinfo clockinfo;
|
||||
/* list of all New if registrations */
|
||||
static struct newifreg_list newifreg_list = TAILQ_HEAD_INITIALIZER(newifreg_list);
|
||||
|
||||
/* baud rate of fastest interface */
|
||||
uint64_t mibif_maxspeed;
|
||||
|
||||
/* user-forced update interval */
|
||||
u_int mibif_force_hc_update_interval;
|
||||
|
||||
/* current update interval */
|
||||
u_int mibif_hc_update_interval;
|
||||
|
||||
/* HC update timer handle */
|
||||
static void *hc_update_timer;
|
||||
|
||||
/*****************************/
|
||||
|
||||
static const struct asn_oid oid_ifMIB = OIDX_ifMIB;
|
||||
@ -280,16 +292,15 @@ link_trap(struct mibif *ifp, int up)
|
||||
(struct snmp_value *)NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Fetch new MIB data.
|
||||
/**
|
||||
* Fetch the GENERIC IFMIB and update the HC counters
|
||||
*/
|
||||
int
|
||||
mib_fetch_ifmib(struct mibif *ifp)
|
||||
static int
|
||||
fetch_generic_mib(struct mibif *ifp, const struct ifmibdata *old)
|
||||
{
|
||||
int name[6];
|
||||
size_t len;
|
||||
void *newmib;
|
||||
struct ifmibdata oldmib = ifp->mib;
|
||||
struct mibif_private *p = ifp->private;
|
||||
|
||||
name[0] = CTL_NET;
|
||||
name[1] = PF_LINK;
|
||||
@ -306,26 +317,144 @@ mib_fetch_ifmib(struct mibif *ifp)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (ifp->trap_enable) {
|
||||
if (!(oldmib.ifmd_flags & IFF_UP)) {
|
||||
if (ifp->mib.ifmd_flags & IFF_UP)
|
||||
link_trap(ifp, 1);
|
||||
/*
|
||||
* Assume that one of the two following compounds is optimized away
|
||||
*/
|
||||
if (ULONG_MAX >= 0xffffffffffffffffULL) {
|
||||
p->hc_inoctets = ifp->mib.ifmd_data.ifi_ibytes;
|
||||
p->hc_outoctets = ifp->mib.ifmd_data.ifi_obytes;
|
||||
p->hc_omcasts = ifp->mib.ifmd_data.ifi_omcasts;
|
||||
p->hc_opackets = ifp->mib.ifmd_data.ifi_opackets;
|
||||
p->hc_imcasts = ifp->mib.ifmd_data.ifi_imcasts;
|
||||
p->hc_ipackets = ifp->mib.ifmd_data.ifi_ipackets;
|
||||
|
||||
} else if (ULONG_MAX >= 0xffffffff) {
|
||||
|
||||
#define UPDATE(HC, MIB) \
|
||||
if (old->ifmd_data.MIB > ifp->mib.ifmd_data.MIB) \
|
||||
p->HC += (0x100000000ULL + \
|
||||
ifp->mib.ifmd_data.MIB) - \
|
||||
old->ifmd_data.MIB; \
|
||||
else \
|
||||
p->HC += ifp->mib.ifmd_data.MIB - \
|
||||
old->ifmd_data.MIB;
|
||||
|
||||
UPDATE(hc_inoctets, ifi_ibytes)
|
||||
UPDATE(hc_outoctets, ifi_obytes)
|
||||
UPDATE(hc_omcasts, ifi_omcasts)
|
||||
UPDATE(hc_opackets, ifi_opackets)
|
||||
UPDATE(hc_imcasts, ifi_imcasts)
|
||||
UPDATE(hc_ipackets, ifi_ipackets)
|
||||
|
||||
#undef UPDATE
|
||||
} else
|
||||
abort();
|
||||
return (0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the 64-bit interface counters
|
||||
*/
|
||||
static void
|
||||
update_hc_counters(void *arg __unused)
|
||||
{
|
||||
struct mibif *ifp;
|
||||
struct ifmibdata oldmib;
|
||||
|
||||
TAILQ_FOREACH(ifp, &mibif_list, link) {
|
||||
oldmib = ifp->mib;
|
||||
(void)fetch_generic_mib(ifp, &oldmib);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recompute the poll timer for the HC counters
|
||||
*/
|
||||
void
|
||||
mibif_reset_hc_timer(void)
|
||||
{
|
||||
u_int ticks;
|
||||
|
||||
if ((ticks = mibif_force_hc_update_interval) == 0) {
|
||||
if (mibif_maxspeed <= 10000000) {
|
||||
/* at 10Mbps overflow needs 3436 seconds */
|
||||
ticks = 3000 * 100; /* 50 minutes */
|
||||
} else if (mibif_maxspeed <= 100000000) {
|
||||
/* at 100Mbps overflow needs 343 seconds */
|
||||
ticks = 300 * 100; /* 5 minutes */
|
||||
} else if (mibif_maxspeed < 650000000) {
|
||||
/* at 622Mbps overflow needs 53 seconds */
|
||||
ticks = 40 * 100; /* 40 seconds */
|
||||
} else if (mibif_maxspeed <= 1000000000) {
|
||||
/* at 1Gbps overflow needs 34 seconds */
|
||||
ticks = 20 * 100; /* 20 seconds */
|
||||
} else {
|
||||
if (!(ifp->mib.ifmd_flags & IFF_UP))
|
||||
link_trap(ifp, 0);
|
||||
/* at 10Gbps overflow needs 3.4 seconds */
|
||||
ticks = 100; /* 1 seconds */
|
||||
}
|
||||
}
|
||||
|
||||
if (ticks == mibif_hc_update_interval)
|
||||
return;
|
||||
|
||||
if (hc_update_timer != NULL) {
|
||||
timer_stop(hc_update_timer);
|
||||
hc_update_timer = NULL;
|
||||
}
|
||||
update_hc_counters(NULL);
|
||||
if ((hc_update_timer = timer_start_repeat(ticks * 10, ticks * 10,
|
||||
update_hc_counters, NULL, module)) == NULL) {
|
||||
syslog(LOG_ERR, "timer_start(%u): %m", ticks);
|
||||
return;
|
||||
}
|
||||
mibif_hc_update_interval = ticks;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fetch new MIB data.
|
||||
*/
|
||||
int
|
||||
mib_fetch_ifmib(struct mibif *ifp)
|
||||
{
|
||||
int name[6];
|
||||
size_t len;
|
||||
void *newmib;
|
||||
struct ifmibdata oldmib = ifp->mib;
|
||||
|
||||
if (fetch_generic_mib(ifp, &oldmib) == -1)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Quoting RFC2863, 3.1.15: "... LinkUp and linkDown traps are
|
||||
* generated just after ifOperStatus leaves, or just before it
|
||||
* enters, the down state, respectively;"
|
||||
*/
|
||||
if (ifp->trap_enable && ifp->mib.ifmd_data.ifi_link_state !=
|
||||
oldmib.ifmd_data.ifi_link_state &&
|
||||
(ifp->mib.ifmd_data.ifi_link_state == LINK_STATE_DOWN ||
|
||||
oldmib.ifmd_data.ifi_link_state == LINK_STATE_DOWN))
|
||||
link_trap(ifp, ifp->mib.ifmd_data.ifi_link_state ==
|
||||
LINK_STATE_UP ? 1 : 0);
|
||||
|
||||
ifp->flags &= ~(MIBIF_HIGHSPEED | MIBIF_VERYHIGHSPEED);
|
||||
if (ifp->mib.ifmd_data.ifi_baudrate > 20000000) {
|
||||
ifp->flags |= MIBIF_HIGHSPEED;
|
||||
if (ifp->mib.ifmd_data.ifi_baudrate > 650000000)
|
||||
ifp->flags |= MIBIF_VERYHIGHSPEED;
|
||||
}
|
||||
if (ifp->mib.ifmd_data.ifi_baudrate > mibif_maxspeed) {
|
||||
mibif_maxspeed = ifp->mib.ifmd_data.ifi_baudrate;
|
||||
mibif_reset_hc_timer();
|
||||
}
|
||||
|
||||
/*
|
||||
* linkspecific MIB
|
||||
*/
|
||||
name[0] = CTL_NET;
|
||||
name[1] = PF_LINK;
|
||||
name[2] = NETLINK_GENERIC;
|
||||
name[3] = IFMIB_IFDATA;
|
||||
name[4] = ifp->sysindex;
|
||||
name[5] = IFDATA_LINKSPECIFIC;
|
||||
if (sysctl(name, 6, NULL, &len, NULL, 0) == -1) {
|
||||
syslog(LOG_WARNING, "sysctl linkmib estimate (%s): %m",
|
||||
@ -517,6 +646,7 @@ get_physaddr(struct mibif *ifp, struct sockaddr_dl *sdl, u_char *ptr)
|
||||
static void
|
||||
mibif_free(struct mibif *ifp)
|
||||
{
|
||||
struct mibif *ifp1;
|
||||
struct mibindexmap *map;
|
||||
struct mibifa *ifa, *ifa1;
|
||||
struct mibrcvaddr *rcv, *rcv1;
|
||||
@ -529,6 +659,18 @@ mibif_free(struct mibif *ifp)
|
||||
(void)mib_ifstack_delete(NULL, ifp);
|
||||
|
||||
TAILQ_REMOVE(&mibif_list, ifp, link);
|
||||
|
||||
/* if this was the fastest interface - recompute this */
|
||||
if (ifp->mib.ifmd_data.ifi_baudrate == mibif_maxspeed) {
|
||||
mibif_maxspeed = ifp->mib.ifmd_data.ifi_baudrate;
|
||||
TAILQ_FOREACH(ifp1, &mibif_list, link)
|
||||
if (ifp1->mib.ifmd_data.ifi_baudrate > mibif_maxspeed)
|
||||
mibif_maxspeed =
|
||||
ifp1->mib.ifmd_data.ifi_baudrate;
|
||||
mibif_reset_hc_timer();
|
||||
}
|
||||
|
||||
free(ifp->private);
|
||||
if (ifp->physaddr != NULL)
|
||||
free(ifp->physaddr);
|
||||
if (ifp->specmib != NULL)
|
||||
@ -587,6 +729,13 @@ mibif_create(u_int sysindex, const char *name)
|
||||
return (NULL);
|
||||
}
|
||||
memset(ifp, 0, sizeof(*ifp));
|
||||
if ((ifp->private = malloc(sizeof(struct mibif_private))) == NULL) {
|
||||
syslog(LOG_WARNING, "%s: %m", __func__);
|
||||
free(ifp);
|
||||
return (NULL);
|
||||
}
|
||||
memset(ifp->private, 0, sizeof(struct mibif_private));
|
||||
|
||||
ifp->sysindex = sysindex;
|
||||
strcpy(ifp->name, name);
|
||||
strcpy(ifp->descr, name);
|
||||
@ -625,6 +774,7 @@ mibif_create(u_int sysindex, const char *name)
|
||||
ifp->counter_disc = get_ticks();
|
||||
}
|
||||
ifp->index = map->ifindex;
|
||||
ifp->mib.ifmd_data.ifi_link_state = LINK_STATE_UNKNOWN;
|
||||
|
||||
INSERT_OBJECT_INT(ifp, &mibif_list);
|
||||
mib_if_number++;
|
||||
|
@ -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.h,v 1.15 2005/06/09 12:36:53 brandt_h Exp $
|
||||
* $Begemot: bsnmp/snmp_mibII/mibII.h,v 1.16 2006/02/14 09:04:19 brandt_h Exp $
|
||||
*
|
||||
* Implementation of the interfaces and IP groups of MIB-II.
|
||||
*/
|
||||
@ -56,7 +56,6 @@
|
||||
#include "snmp_mibII.h"
|
||||
#include "mibII_tree.h"
|
||||
|
||||
|
||||
/*
|
||||
* Interface list and flags.
|
||||
*/
|
||||
@ -66,12 +65,19 @@ enum {
|
||||
MIBIF_HIGHSPEED = 0x0002,
|
||||
MIBIF_VERYHIGHSPEED = 0x0004,
|
||||
};
|
||||
#define hc_inoctets mib.ifmd_data.ifi_ibytes
|
||||
#define hc_outoctets mib.ifmd_data.ifi_obytes
|
||||
#define hc_omcasts mib.ifmd_data.ifi_omcasts
|
||||
#define hc_opackets mib.ifmd_data.ifi_opackets
|
||||
#define hc_imcasts mib.ifmd_data.ifi_imcasts
|
||||
#define hc_ipackets mib.ifmd_data.ifi_ipackets
|
||||
|
||||
/*
|
||||
* Private mibif data - hang off from the mibif.
|
||||
*/
|
||||
struct mibif_private {
|
||||
uint64_t hc_inoctets;
|
||||
uint64_t hc_outoctets;
|
||||
uint64_t hc_omcasts;
|
||||
uint64_t hc_opackets;
|
||||
uint64_t hc_imcasts;
|
||||
uint64_t hc_ipackets;
|
||||
};
|
||||
#define MIBIF_PRIV(IFP) ((struct mibif_private *)((IFP)->private))
|
||||
|
||||
/*
|
||||
* Interface addresses.
|
||||
@ -193,6 +199,18 @@ extern uint64_t mibarpticks;
|
||||
/* info on system clocks */
|
||||
extern struct clockinfo clockinfo;
|
||||
|
||||
/* baud rate of fastest interface */
|
||||
extern uint64_t mibif_maxspeed;
|
||||
|
||||
/* user-forced update interval */
|
||||
extern u_int mibif_force_hc_update_interval;
|
||||
|
||||
/* current update interval */
|
||||
extern u_int mibif_hc_update_interval;
|
||||
|
||||
/* re-compute update interval */
|
||||
void mibif_reset_hc_timer(void);
|
||||
|
||||
/* get interfaces and interface addresses. */
|
||||
void mib_fetch_interfaces(void);
|
||||
|
||||
|
@ -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.16 2005/11/02 12:07:40 brandt_h Exp $
|
||||
* $Begemot: bsnmp/snmp_mibII/mibII_interfaces.c,v 1.17 2006/02/14 09:04:19 brandt_h Exp $
|
||||
*
|
||||
* Interfaces group.
|
||||
*/
|
||||
@ -463,19 +463,20 @@ op_ifxtable(struct snmp_context *ctx, struct snmp_value *value,
|
||||
case LEAF_ifHCInOctets:
|
||||
if (!(ifp->flags & MIBIF_HIGHSPEED))
|
||||
goto again;
|
||||
value->v.counter64 = ifp->hc_inoctets;
|
||||
value->v.counter64 = MIBIF_PRIV(ifp)->hc_inoctets;
|
||||
break;
|
||||
|
||||
case LEAF_ifHCInUcastPkts:
|
||||
if (!(ifp->flags & (MIBIF_VERYHIGHSPEED|MIBIF_HIGHSPEED)))
|
||||
goto again;
|
||||
value->v.counter64 = ifp->hc_ipackets - ifp->hc_imcasts;
|
||||
value->v.counter64 = MIBIF_PRIV(ifp)->hc_ipackets -
|
||||
MIBIF_PRIV(ifp)->hc_imcasts;
|
||||
break;
|
||||
|
||||
case LEAF_ifHCInMulticastPkts:
|
||||
if (!(ifp->flags & (MIBIF_VERYHIGHSPEED|MIBIF_HIGHSPEED)))
|
||||
goto again;
|
||||
value->v.counter64 = ifp->hc_imcasts;
|
||||
value->v.counter64 = MIBIF_PRIV(ifp)->hc_imcasts;
|
||||
break;
|
||||
|
||||
case LEAF_ifHCInBroadcastPkts:
|
||||
@ -487,19 +488,20 @@ op_ifxtable(struct snmp_context *ctx, struct snmp_value *value,
|
||||
case LEAF_ifHCOutOctets:
|
||||
if (!(ifp->flags & MIBIF_HIGHSPEED))
|
||||
goto again;
|
||||
value->v.counter64 = ifp->hc_outoctets;
|
||||
value->v.counter64 = MIBIF_PRIV(ifp)->hc_outoctets;
|
||||
break;
|
||||
|
||||
case LEAF_ifHCOutUcastPkts:
|
||||
if (!(ifp->flags & (MIBIF_VERYHIGHSPEED|MIBIF_HIGHSPEED)))
|
||||
goto again;
|
||||
value->v.counter64 = ifp->hc_opackets - ifp->hc_omcasts;
|
||||
value->v.counter64 = MIBIF_PRIV(ifp)->hc_opackets -
|
||||
MIBIF_PRIV(ifp)->hc_omcasts;
|
||||
break;
|
||||
|
||||
case LEAF_ifHCOutMulticastPkts:
|
||||
if (!(ifp->flags & (MIBIF_VERYHIGHSPEED|MIBIF_HIGHSPEED)))
|
||||
goto again;
|
||||
value->v.counter64 = ifp->hc_omcasts;
|
||||
value->v.counter64 = MIBIF_PRIV(ifp)->hc_omcasts;
|
||||
break;
|
||||
|
||||
case LEAF_ifHCOutBroadcastPkts:
|
||||
|
@ -26,11 +26,18 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Begemot: bsnmp/snmp_mibII/mibII_route.c,v 1.7 2005/06/09 12:36:53 brandt_h Exp $
|
||||
* $Begemot: bsnmp/snmp_mibII/mibII_route.c,v 1.9 2005/10/06 07:15:00 brandt_h Exp $
|
||||
*
|
||||
* Routing table
|
||||
*/
|
||||
#include "support.h"
|
||||
|
||||
#ifdef HAVE_SYS_TREE_H
|
||||
#include <sys/tree.h>
|
||||
#else
|
||||
#include "tree.h"
|
||||
#endif
|
||||
|
||||
#include "mibII.h"
|
||||
#include "mibII_oid.h"
|
||||
|
||||
|
@ -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_tree.def,v 1.12 2004/08/06 08:47:05 brandt Exp $
|
||||
# $Begemot: bsnmp/snmp_mibII/mibII_tree.def,v 1.13 2006/02/14 09:04:19 brandt_h Exp $
|
||||
#
|
||||
# Definition of the standard interfaces and ip trees.
|
||||
#
|
||||
@ -230,6 +230,23 @@
|
||||
(50 udpMIB
|
||||
)
|
||||
))
|
||||
(4 private
|
||||
(1 enterprises
|
||||
(12325 fokus
|
||||
(1 begemot
|
||||
(3 begemotIp
|
||||
(1 begemotIpObjects
|
||||
(1 begemotMib2
|
||||
(1 begemotIfMaxspeed COUNTER64 op_begemot_mibII GET)
|
||||
(2 begemotIfPoll TIMETICKS op_begemot_mibII GET)
|
||||
(3 begemotIfForcePoll TIMETICKS op_begemot_mibII GET SET)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(6 snmpV2
|
||||
(3 snmpModules
|
||||
(1 snmpMIB
|
||||
|
@ -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.17 2005/05/23 09:03:43 brandt_h Exp $
|
||||
* $Begemot: bsnmp/snmp_mibII/snmp_mibII.h,v 1.18 2006/02/14 09:04:19 brandt_h Exp $
|
||||
*
|
||||
* Implementation of the interfaces and IP groups of MIB-II.
|
||||
*/
|
||||
@ -79,6 +79,9 @@ struct mibif {
|
||||
|
||||
/* to be set by ifType specific modules. This is ifSpecific. */
|
||||
struct asn_oid spec_oid;
|
||||
|
||||
/* private data - don't touch */
|
||||
void *private;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -26,7 +26,7 @@
|
||||
-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
-- SUCH DAMAGE.
|
||||
--
|
||||
-- $Begemot: bsnmp/snmp_ntp/BEGEMOT-NTP-MIB.txt,v 1.2 2005/04/26 13:38:01 brandt_h Exp $
|
||||
-- $Begemot: bsnmp/snmp_ntp/BEGEMOT-NTP-MIB.txt,v 1.3 2005/10/04 08:13:41 brandt_h Exp $
|
||||
--
|
||||
-- Private MIB for NTP module.
|
||||
--
|
||||
@ -35,11 +35,13 @@ BEGEMOT-NTP-MIB DEFINITIONS ::= BEGIN
|
||||
IMPORTS
|
||||
MODULE-IDENTITY, OBJECT-TYPE, TimeTicks, Unsigned32, Counter64
|
||||
FROM SNMPv2-SMI
|
||||
TruthValue
|
||||
FROM SNMPv2-TC
|
||||
begemot
|
||||
FROM BEGEMOT-MIB;
|
||||
|
||||
begemotNtp MODULE-IDENTITY
|
||||
LAST-UPDATED "200503210000Z"
|
||||
LAST-UPDATED "200509300000Z"
|
||||
ORGANIZATION "German Aerospace Center"
|
||||
CONTACT-INFO
|
||||
" Hartmut Brandt
|
||||
@ -114,4 +116,29 @@ begemotNtpStability OBJECT-TYPE
|
||||
"Current stability in ppm multiplied by 2^32."
|
||||
::= { begemotNtpObjects 6 }
|
||||
|
||||
begemotNtpJitterThresh OBJECT-TYPE
|
||||
SYNTAX Counter64
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Jitter trap threshold in seconds multiplied by 2^32."
|
||||
::= { begemotNtpObjects 7 }
|
||||
|
||||
begemotNtpStabilityThresh OBJECT-TYPE
|
||||
SYNTAX Counter64
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Stability trap threshold in ppm multiplied by 2^32."
|
||||
::= { begemotNtpObjects 8 }
|
||||
|
||||
begemotNtpTrapEnable OBJECT-TYPE
|
||||
SYNTAX TruthValue
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Enables the sending of traps when either the peer is lost/
|
||||
found or one of the above thresholds is crossed."
|
||||
::= { begemotNtpObjects 9 }
|
||||
|
||||
END
|
||||
|
@ -27,7 +27,7 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Begemot: bsnmp/snmp_ntp/snmp_ntp.c,v 1.4 2005/05/23 09:03:48 brandt_h Exp $
|
||||
* $Begemot: bsnmp/snmp_ntp/snmp_ntp.c,v 1.9 2005/10/06 07:15:01 brandt_h Exp $
|
||||
*
|
||||
* NTP interface for SNMPd.
|
||||
*/
|
||||
@ -40,13 +40,18 @@
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <netdb.h>
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#elif defined(HAVE_INTTYPES_H)
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "support.h"
|
||||
#include "snmpmod.h"
|
||||
#include "ntp_tree.h"
|
||||
#include "ntp_oid.h"
|
||||
@ -173,7 +178,7 @@ static uint32_t ntp_timeout;
|
||||
static void ntpd_input(int, void *);
|
||||
static int open_socket(void);
|
||||
|
||||
/* the initialisation function */
|
||||
/* the initialization function */
|
||||
static int
|
||||
ntp_init(struct lmodule *mod, int argc, char *argv[] __unused)
|
||||
{
|
||||
@ -360,6 +365,7 @@ ntpd_request(u_int op, u_int associd, const char *vars)
|
||||
free(rpkt);
|
||||
return (-1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -431,7 +437,7 @@ ntpd_read(uint16_t *op, uint16_t *associd, u_char **data, size_t *datalen)
|
||||
}
|
||||
|
||||
ptr = pkt;
|
||||
if (*ptr != ((NTPC_VERSION << 3) | NTPC_MODE)) {
|
||||
if ((*ptr & 0x3f) != ((NTPC_VERSION << 3) | NTPC_MODE)) {
|
||||
syslog(LOG_ERR, "unexpected packet version 0x%x", *ptr);
|
||||
free(*data);
|
||||
return (-1);
|
||||
@ -720,7 +726,7 @@ val_parse_ip(const char *val, u_char ip[4])
|
||||
{
|
||||
int r, n, error;
|
||||
struct addrinfo hints, *res0;
|
||||
struct sockaddr_in *sin;
|
||||
struct sockaddr_in *sin_local;
|
||||
|
||||
r = sscanf(val, "%hhd.%hhd.%hhd.%hhd%n",
|
||||
&ip[0], &ip[1], &ip[2], &ip[3], &n);
|
||||
@ -743,11 +749,11 @@ val_parse_ip(const char *val, u_char ip[4])
|
||||
return (-1);
|
||||
}
|
||||
|
||||
sin = (struct sockaddr_in *)(void *)res0->ai_addr;
|
||||
ip[3] = sin->sin_addr.s_addr >> 24;
|
||||
ip[2] = sin->sin_addr.s_addr >> 16;
|
||||
ip[1] = sin->sin_addr.s_addr >> 8;
|
||||
ip[0] = sin->sin_addr.s_addr >> 0;
|
||||
sin_local = (struct sockaddr_in *)(void *)res0->ai_addr;
|
||||
ip[3] = sin_local->sin_addr.s_addr >> 24;
|
||||
ip[2] = sin_local->sin_addr.s_addr >> 16;
|
||||
ip[1] = sin_local->sin_addr.s_addr >> 8;
|
||||
ip[0] = sin_local->sin_addr.s_addr >> 0;
|
||||
|
||||
freeaddrinfo(res0);
|
||||
return (0);
|
||||
@ -1517,7 +1523,7 @@ op_begemot_ntp(struct snmp_context *ctx __unused, struct snmp_value *value,
|
||||
switch (which) {
|
||||
|
||||
case LEAF_begemotNtpHost:
|
||||
/* only at initialisation */
|
||||
/* only at initialization */
|
||||
if (community != COMM_INITIALIZE)
|
||||
return (SNMP_ERR_NOT_WRITEABLE);
|
||||
|
||||
@ -1527,7 +1533,7 @@ op_begemot_ntp(struct snmp_context *ctx __unused, struct snmp_value *value,
|
||||
return (SNMP_ERR_NOERROR);
|
||||
|
||||
case LEAF_begemotNtpPort:
|
||||
/* only at initialisation */
|
||||
/* only at initialization */
|
||||
if (community != COMM_INITIALIZE)
|
||||
return (SNMP_ERR_NOT_WRITEABLE);
|
||||
|
||||
|
@ -29,10 +29,10 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $Begemot: bsnmp/snmpd/bsnmpd.1,v 1.9 2005/10/04 08:46:54 brandt_h Exp $
|
||||
.\" $Begemot: bsnmp/snmpd/bsnmpd.1,v 1.12 2006/02/27 09:50:03 brandt_h Exp $
|
||||
.\"
|
||||
.Dd October 4, 2005
|
||||
.Dt SNMPD 1
|
||||
.Dd February 27, 2006
|
||||
.Dt BSNMPD 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm bsnmpd
|
||||
@ -49,7 +49,7 @@
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
daemon servers the internet SNMP (Simple Network Management Protocol).
|
||||
daemon server the internet SNMP (Simple Network Management Protocol).
|
||||
It is intended to serve only the absolute basic MIBs and implement all other
|
||||
MIBs through loadable modules.
|
||||
In this way the
|
||||
@ -258,9 +258,14 @@ This is the default search path for system include files.
|
||||
.It Pa @MIBSPATH@BEGEMOT-MIB.txt
|
||||
.It Pa @MIBSPATH@BEGEMOT-SNMPD.txt
|
||||
The definitions for the MIBs implemented in the daemon.
|
||||
.It Pa /etc/hosts.allow, /etc/hosts.deny
|
||||
Access controls that should be enforced by TCP wrappers should be defined here.
|
||||
Further details are described in
|
||||
.Xr hosts_access 5 .
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr gensnmptree 1
|
||||
.Xr gensnmptree 1 ,
|
||||
.Xr hosts_access 5
|
||||
.Sh STANDARDS
|
||||
The
|
||||
.Nm
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Begemot: bsnmp/snmpd/config.c,v 1.24 2005/10/04 11:21:37 brandt_h Exp $
|
||||
* $Begemot: bsnmp/snmpd/config.c,v 1.25 2006/02/14 09:04:20 brandt_h Exp $
|
||||
*
|
||||
* Parse configuration file.
|
||||
*/
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Begemot: bsnmp/snmpd/export.c,v 1.7 2004/08/06 08:47:11 brandt Exp $
|
||||
* $Begemot: bsnmp/snmpd/export.c,v 1.8 2006/02/14 09:04:20 brandt_h Exp $
|
||||
*
|
||||
* Support functions for modules.
|
||||
*/
|
||||
@ -120,6 +120,30 @@ string_get(struct snmp_value *value, const u_char *ptr, ssize_t len)
|
||||
return (SNMP_ERR_NOERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a string value for a response packet but cut it if it is too long.
|
||||
*/
|
||||
int
|
||||
string_get_max(struct snmp_value *value, const u_char *ptr, ssize_t len,
|
||||
size_t maxlen)
|
||||
{
|
||||
|
||||
if (ptr == NULL) {
|
||||
value->v.octetstring.len = 0;
|
||||
value->v.octetstring.octets = NULL;
|
||||
return (SNMP_ERR_NOERROR);
|
||||
}
|
||||
if (len == -1)
|
||||
len = strlen(ptr);
|
||||
if ((size_t)len > maxlen)
|
||||
len = maxlen;
|
||||
value->v.octetstring.len = (u_long)len;
|
||||
if ((value->v.octetstring.octets = malloc((size_t)len)) == NULL)
|
||||
return (SNMP_ERR_RES_UNAVAIL);
|
||||
memcpy(value->v.octetstring.octets, ptr, (size_t)len);
|
||||
return (SNMP_ERR_NOERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Support for IPADDRESS
|
||||
*
|
||||
|
@ -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.97 2005/10/04 14:32:45 brandt_h Exp $
|
||||
* $Begemot: bsnmp/snmpd/main.c,v 1.100 2006/02/14 09:04:20 brandt_h Exp $
|
||||
*
|
||||
* SNMPd main stuff.
|
||||
*/
|
||||
@ -52,6 +52,7 @@
|
||||
#include <tcpd.h>
|
||||
#endif
|
||||
|
||||
#include "support.h"
|
||||
#include "snmpmod.h"
|
||||
#include "snmpd.h"
|
||||
#include "tree.h"
|
||||
@ -1386,7 +1387,9 @@ main(int argc, char *argv[])
|
||||
if (value == NULL)
|
||||
syslog(LOG_ERR,
|
||||
"no value for 'trace'");
|
||||
snmp_trace = strtoul(value, NULL, 0);
|
||||
else
|
||||
snmp_trace = strtoul(value,
|
||||
NULL, 0);
|
||||
break;
|
||||
|
||||
case -1:
|
||||
|
@ -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.15 2005/02/25 11:50:43 brandt_h Exp $
|
||||
# $Begemot: bsnmp/snmpd/snmpd.config,v 1.16 2006/02/14 09:04:20 brandt_h Exp $
|
||||
#
|
||||
# Example configuration file.
|
||||
#
|
||||
|
@ -31,7 +31,7 @@
|
||||
.\"
|
||||
.\" $Begemot: bsnmp/snmpd/snmpmod.3,v 1.14 2005/10/04 13:30:35 brandt_h Exp $
|
||||
.\"
|
||||
.Dd October 4, 2005
|
||||
.Dd February 27, 2006
|
||||
.Dt SNMPMOD 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -85,6 +85,7 @@
|
||||
.Nm string_commit ,
|
||||
.Nm string_rollback ,
|
||||
.Nm string_get ,
|
||||
.Nm string_get_max ,
|
||||
.Nm string_free ,
|
||||
.Nm ip_save ,
|
||||
.Nm ip_rollback ,
|
||||
@ -197,6 +198,8 @@ Begemot SNMP library
|
||||
.Fn string_rollback "struct snmp_context *ctx" "u_char **strp"
|
||||
.Ft int
|
||||
.Fn string_get "struct snmp_value *val" "const u_char *str" "ssize_t len"
|
||||
.Ft int
|
||||
.Fn string_get_max "struct snmp_value *val" "const u_char *str" "ssize_t len" "size_t maxlen"
|
||||
.Ft void
|
||||
.Fn string_free "struct snmp_context *ctx"
|
||||
.Ft int
|
||||
@ -771,6 +774,10 @@ simply frees the saved old value in the scratch area.
|
||||
frees the new value, and puts back the old one.
|
||||
.It Fn string_get
|
||||
is used for GET or GETNEXT.
|
||||
The function
|
||||
.It Fn string_get_max
|
||||
can be used instead of
|
||||
.Nf stringto ensure that the returned string has a certain maximum length.
|
||||
If
|
||||
.Fa len
|
||||
is -1, the length is computed via
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Begemot: bsnmp/snmpd/snmpmod.h,v 1.31 2005/10/04 13:30:36 brandt_h Exp $
|
||||
* $Begemot: bsnmp/snmpd/snmpmod.h,v 1.32 2006/02/14 09:04:20 brandt_h Exp $
|
||||
*
|
||||
* SNMP daemon data and functions exported to modules.
|
||||
*/
|
||||
@ -400,6 +400,7 @@ int string_save(struct snmp_value *, struct snmp_context *, ssize_t, u_char **);
|
||||
void string_commit(struct snmp_context *);
|
||||
void string_rollback(struct snmp_context *, u_char **);
|
||||
int string_get(struct snmp_value *, const u_char *, ssize_t);
|
||||
int string_get_max(struct snmp_value *, const u_char *, ssize_t, size_t);
|
||||
void string_free(struct snmp_context *);
|
||||
|
||||
int ip_save(struct snmp_value *, struct snmp_context *, u_char *);
|
||||
|
@ -25,7 +25,7 @@ DEFSDIR= ${SHAREDIR}/snmp/defs
|
||||
|
||||
CFLAGS+= -I${CONTRIB}/lib -I${CONTRIB}/snmpd -I. -DUSE_LIBBEGEMOT
|
||||
CFLAGS+= -DUSE_TCPWRAPPERS -DQUADFMT='"llu"' -DQUADXFMT='"llx"'
|
||||
CFLAGS+= -DHAVE_STDINT_H -DHAVE_INTTYPES_H
|
||||
CFLAGS+= -DHAVE_STDINT_H -DHAVE_INTTYPES_H -DHAVE_ERR_H -DHAVE_STRLCPY
|
||||
DPADD= ${LIBBEGEMOT} ${LIBBSNMP}
|
||||
LDADD= -lbegemot -lbsnmp -lwrap
|
||||
|
||||
|
@ -6,16 +6,18 @@ CONTRIB= ${.CURDIR}/../../../../contrib/bsnmp
|
||||
.PATH: ${CONTRIB}/snmp_mibII
|
||||
|
||||
MOD= mibII
|
||||
SRCS= mibII.c mibII_ifmib.c mibII_ip.c mibII_interfaces.c \
|
||||
mibII_ipaddr.c mibII_ifstack.c mibII_rcvaddr.c \
|
||||
mibII_nettomedia.c mibII_tcp.c mibII_udp.c mibII_route.c
|
||||
SRCS= mibII.c mibII_begemot.c mibII_ifmib.c mibII_ifstack.c \
|
||||
mibII_interfaces.c mibII_ip.c mibII_ipaddr.c mibII_nettomedia.c \
|
||||
mibII_rcvaddr.c mibII_route.c mibII_tcp.c mibII_udp.c
|
||||
XSYM= ipAddrTable ifTable ifRcvAddressEntry ifMIB ipMIB tcpMIB udpMIB \
|
||||
ipForward ifIndex linkDown linkUp
|
||||
MAN= snmp_mibII.3
|
||||
|
||||
CFLAGS+= -I${CONTRIB}/lib -I${CONTRIB}/snmpd
|
||||
CFLAGS+= -DHAVE_ERR_H -DHAVE_GETADDRINFO -DHAVE_STRLCPY -DHAVE_SYS_TREE_H
|
||||
|
||||
DEFS= ${MOD}_tree.def
|
||||
INCS= snmp_${MOD}.h
|
||||
BMIBS= BEGEMOT-IP-MIB.txt BEGEMOT-MIB2-MIB.txt
|
||||
|
||||
.include <bsd.snmpmod.mk>
|
||||
|
Loading…
x
Reference in New Issue
Block a user