diff options
author | harti <harti@FreeBSD.org> | 2005-10-04 14:41:06 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2005-10-04 14:41:06 +0000 |
commit | efb2dfa1774240830b3f74b7fe4ab8050cc1cda0 (patch) | |
tree | 939b9a00cfa4d79510a088859c9352b689740218 /contrib/bsnmp/snmp_ntp | |
parent | 2b366eef52ee173d11c8c3b0570cd771e5c0044a (diff) | |
download | FreeBSD-src-efb2dfa1774240830b3f74b7fe4ab8050cc1cda0.zip FreeBSD-src-efb2dfa1774240830b3f74b7fe4ab8050cc1cda0.tar.gz |
Virgin import of bsnmpd 1.11
Diffstat (limited to 'contrib/bsnmp/snmp_ntp')
-rw-r--r-- | contrib/bsnmp/snmp_ntp/BEGEMOT-NTP-MIB.txt | 31 | ||||
-rw-r--r-- | contrib/bsnmp/snmp_ntp/Makefile.in | 38 | ||||
-rw-r--r-- | contrib/bsnmp/snmp_ntp/snmp_ntp.c | 27 |
3 files changed, 83 insertions, 13 deletions
diff --git a/contrib/bsnmp/snmp_ntp/BEGEMOT-NTP-MIB.txt b/contrib/bsnmp/snmp_ntp/BEGEMOT-NTP-MIB.txt index c5a4495..cfd2bc7 100644 --- a/contrib/bsnmp/snmp_ntp/BEGEMOT-NTP-MIB.txt +++ b/contrib/bsnmp/snmp_ntp/BEGEMOT-NTP-MIB.txt @@ -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 diff --git a/contrib/bsnmp/snmp_ntp/Makefile.in b/contrib/bsnmp/snmp_ntp/Makefile.in new file mode 100644 index 0000000..742e7fc --- /dev/null +++ b/contrib/bsnmp/snmp_ntp/Makefile.in @@ -0,0 +1,38 @@ +# Copyright (c) 2005 +# Hartmut Brandt. +# All rights reserved. +# +# Author: Harti Brandt <harti@freebsd.org> +# +# $Begemot: bsnmp/snmp_ntp/Makefile.in,v 1.2 2005/05/23 09:03:47 brandt_h Exp $ +# +MOD= ntp +SRCS= ${MOD}_tree.c snmp_ntp.c +DEFS= ntp_tree.def +BMIBS= BEGEMOT-NTP-MIB.txt NTP-MIB.txt NTP-PROXY-MIB.txt +# MAN3= snmp_ntp.3 +MANFILTER= sed -e 's%@MODPATH@%${LIBDIR}/%g' \ + -e 's%@DEFPATH@%${DEFSDIR}/%g' \ + -e 's%@MIBSPATH@%${MIBSDIR}/%g' + +XSYM= ntpMIB + +LIB= snmp_${MOD}.la +SHLIB_MAJOR= 3 +SHLIB_MINOR= 0 + +CFLAGS+= -I$(srcdir) -I$(srcdir)/../lib -I$(builddir) -I$(srcdir)/../snmpd + +CLEANFILES += ${MOD}_oid.h ${MOD}_tree.c ${MOD}_tree.h + +# for bootstrapping +GENSNMPTREE= ${builddir}/../gensnmptree/gensnmptree + +$(LIB): ${MOD}_oid.h ${MOD}_tree.h $(SRCS:.c=.lo) + $(LIBTOOL) --mode=link $(CC) $(LDLAGS) -module -o $@ $(SRCS:.c=.lo) -rpath $(libdir) -version-info $(SHLIB_MAJOR):$(SHLIB_MINOR) + +${MOD}_oid.h: ${MOD}_tree.def + ${GENSNMPTREE} <${srcdir}/${MOD}_tree.def -e ${XSYM} >$@ + +${MOD}_tree.h ${MOD}_tree.c : ${MOD}_tree.def + ${GENSNMPTREE} <${srcdir}/${MOD}_tree.def -l -p ${MOD}_ diff --git a/contrib/bsnmp/snmp_ntp/snmp_ntp.c b/contrib/bsnmp/snmp_ntp/snmp_ntp.c index edfb736..b798847 100644 --- a/contrib/bsnmp/snmp_ntp/snmp_ntp.c +++ b/contrib/bsnmp/snmp_ntp/snmp_ntp.c @@ -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.7 2005/10/04 11:21:36 brandt_h Exp $ * * NTP interface for SNMPd. */ @@ -40,7 +40,11 @@ #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> @@ -173,7 +177,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 +364,7 @@ ntpd_request(u_int op, u_int associd, const char *vars) free(rpkt); return (-1); } + return (0); } /* @@ -431,7 +436,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 +725,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 +748,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 +1522,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 +1532,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); |