[Midnightbsd-cvs] src [11089] trunk/contrib/bsnmp: update
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Tue Jun 19 10:44:13 EDT 2018
Revision: 11089
http://svnweb.midnightbsd.org/src/?rev=11089
Author: laffer1
Date: 2018-06-19 10:44:12 -0400 (Tue, 19 Jun 2018)
Log Message:
-----------
update
Modified Paths:
--------------
trunk/contrib/bsnmp/FREEBSD-Xlist
trunk/contrib/bsnmp/FREEBSD-upgrade
trunk/contrib/bsnmp/gensnmpdef/gensnmpdef.1
trunk/contrib/bsnmp/gensnmpdef/gensnmpdef.c
trunk/contrib/bsnmp/gensnmptree/gensnmptree.1
trunk/contrib/bsnmp/gensnmptree/gensnmptree.c
trunk/contrib/bsnmp/lib/asn1.3
trunk/contrib/bsnmp/lib/asn1.c
trunk/contrib/bsnmp/lib/asn1.h
trunk/contrib/bsnmp/lib/bsnmpagent.3
trunk/contrib/bsnmp/lib/bsnmpclient.3
trunk/contrib/bsnmp/lib/bsnmplib.3
trunk/contrib/bsnmp/lib/snmp.c
trunk/contrib/bsnmp/lib/snmp.h
trunk/contrib/bsnmp/lib/snmpagent.c
trunk/contrib/bsnmp/lib/snmpagent.h
trunk/contrib/bsnmp/lib/snmpclient.c
trunk/contrib/bsnmp/lib/snmpclient.h
trunk/contrib/bsnmp/lib/snmpcrypto.c
trunk/contrib/bsnmp/lib/snmppriv.h
trunk/contrib/bsnmp/lib/support.c
trunk/contrib/bsnmp/lib/support.h
trunk/contrib/bsnmp/lib/tc.def
trunk/contrib/bsnmp/snmp_mibII/BEGEMOT-IP-MIB.txt
trunk/contrib/bsnmp/snmp_mibII/mibII.c
trunk/contrib/bsnmp/snmp_mibII/mibII.h
trunk/contrib/bsnmp/snmp_mibII/mibII_begemot.c
trunk/contrib/bsnmp/snmp_mibII/mibII_ifmib.c
trunk/contrib/bsnmp/snmp_mibII/mibII_ifstack.c
trunk/contrib/bsnmp/snmp_mibII/mibII_interfaces.c
trunk/contrib/bsnmp/snmp_mibII/mibII_ip.c
trunk/contrib/bsnmp/snmp_mibII/mibII_ipaddr.c
trunk/contrib/bsnmp/snmp_mibII/mibII_nettomedia.c
trunk/contrib/bsnmp/snmp_mibII/mibII_rcvaddr.c
trunk/contrib/bsnmp/snmp_mibII/mibII_route.c
trunk/contrib/bsnmp/snmp_mibII/mibII_tcp.c
trunk/contrib/bsnmp/snmp_mibII/mibII_tree.def
trunk/contrib/bsnmp/snmp_mibII/mibII_udp.c
trunk/contrib/bsnmp/snmp_mibII/snmp_mibII.3
trunk/contrib/bsnmp/snmp_mibII/snmp_mibII.h
trunk/contrib/bsnmp/snmp_ntp/NTP-MIB.txt
trunk/contrib/bsnmp/snmp_ntp/NTP-PROXY-MIB.txt
trunk/contrib/bsnmp/snmp_target/snmp_target.3
trunk/contrib/bsnmp/snmp_target/target_snmp.c
trunk/contrib/bsnmp/snmp_target/target_tree.def
trunk/contrib/bsnmp/snmp_usm/snmp_usm.3
trunk/contrib/bsnmp/snmp_usm/usm_snmp.c
trunk/contrib/bsnmp/snmp_usm/usm_tree.def
trunk/contrib/bsnmp/snmp_vacm/snmp_vacm.3
trunk/contrib/bsnmp/snmp_vacm/vacm_snmp.c
trunk/contrib/bsnmp/snmp_vacm/vacm_tree.def
trunk/contrib/bsnmp/snmpd/BEGEMOT-MIB.txt
trunk/contrib/bsnmp/snmpd/BEGEMOT-SNMPD.txt
trunk/contrib/bsnmp/snmpd/FOKUS-MIB.txt
trunk/contrib/bsnmp/snmpd/action.c
trunk/contrib/bsnmp/snmpd/bsnmpd.1
trunk/contrib/bsnmp/snmpd/config.c
trunk/contrib/bsnmp/snmpd/export.c
trunk/contrib/bsnmp/snmpd/main.c
trunk/contrib/bsnmp/snmpd/snmpd.config
trunk/contrib/bsnmp/snmpd/snmpd.h
trunk/contrib/bsnmp/snmpd/snmpd.sh
trunk/contrib/bsnmp/snmpd/snmpmod.3
trunk/contrib/bsnmp/snmpd/snmpmod.h
trunk/contrib/bsnmp/snmpd/trans_lsock.c
trunk/contrib/bsnmp/snmpd/trans_lsock.h
trunk/contrib/bsnmp/snmpd/trans_udp.c
trunk/contrib/bsnmp/snmpd/trans_udp.h
trunk/contrib/bsnmp/snmpd/trap.c
trunk/contrib/bsnmp/snmpd/tree.def
Modified: trunk/contrib/bsnmp/FREEBSD-Xlist
===================================================================
--- trunk/contrib/bsnmp/FREEBSD-Xlist 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/FREEBSD-Xlist 2018-06-19 14:44:12 UTC (rev 11089)
@@ -1,4 +1,4 @@
-#$FreeBSD: src/contrib/bsnmp/FREEBSD-Xlist,v 1.5 2006/03/13 09:30:26 harti Exp $
+#$FreeBSD: stable/10/contrib/bsnmp/FREEBSD-Xlist 156677 2006-03-13 09:30:26Z harti $
*/Makefile.in
*/acinclude.m4
*/aclocal.m4
Modified: trunk/contrib/bsnmp/FREEBSD-upgrade
===================================================================
--- trunk/contrib/bsnmp/FREEBSD-upgrade 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/FREEBSD-upgrade 2018-06-19 14:44:12 UTC (rev 11089)
@@ -1,4 +1,4 @@
-$MidnightBSD$
+$FreeBSD: stable/10/contrib/bsnmp/FREEBSD-upgrade 125012 2004-01-26 10:28:31Z harti $
This is the Begemot micro-SNMP daemon. It is the base for the ILMI daemon
for ngATM. Be careful to feed changes back to the maintainer
Modified: trunk/contrib/bsnmp/gensnmpdef/gensnmpdef.1
===================================================================
--- trunk/contrib/bsnmp/gensnmpdef/gensnmpdef.1 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/gensnmpdef/gensnmpdef.1 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
.\" All rights reserved.
.\"
.\" Author: Harti Brandt <harti at FreeBSD.org>
-.\"
+.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
@@ -13,7 +13,7 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\"
+.\"
.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/gensnmpdef/gensnmpdef.c
===================================================================
--- trunk/contrib/bsnmp/gensnmpdef/gensnmpdef.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/gensnmpdef/gensnmpdef.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -1,10 +1,10 @@
-/*
+/*
* Copyright (C) 2004-2006
* Hartmut Brandt.
* All rights reserved.
- *
+ *
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -126,9 +126,11 @@
while (level < n->oidlen - 1) {
if (level >= cut) {
+ n1 = smiGetNodeByOID(level + 1, n->oid);
+ if (n1 == NULL)
+ continue;
pindent(level);
printf("(%u", n->oid[level]);
- n1 = smiGetNodeByOID(level + 1, n->oid);
printf(" ");
print_name(n1);
printf("\n");
@@ -233,7 +235,7 @@
printf(" op_%s", p->name);
print_access(n->access);
-
+
printf(")\n");
}
@@ -397,12 +399,11 @@
save_typdef(char *name)
{
struct tdef *t;
- t = malloc(sizeof(struct tdef));
+ t = calloc(1, sizeof(struct tdef));
if (t == NULL)
err(1, NULL);
- memset(t, 0 , sizeof(struct tdef));
t->name = name;
SLIST_INSERT_HEAD(&tdefs, t, link);
}
@@ -422,7 +423,7 @@
print_enum_typedef(SmiType *t)
{
SmiNamedNumber *nnum;
-
+
for (nnum = smiGetFirstNamedNumber(t); nnum != NULL;
nnum = smiGetNextNamedNumber(nnum)) {
printf("\t%ld %s\n" , nnum->value.value.integer32, nnum->name);
@@ -434,10 +435,10 @@
{
SmiType *type;
struct tdef *t = NULL;
-
+
type = smiGetNodeType(n);
assert(type != NULL);
-
+
if (type->basetype == SMI_BASETYPE_ENUM) {
if (do_typedef == 'e' && type->name != NULL) {
SLIST_FOREACH(t, &tdefs, link) {
@@ -450,7 +451,7 @@
printf("typedef %sType ENUM (\n", n->name);
else
return;
-
+
print_enum_typedef(type);
printf(")\n\n");
@@ -476,7 +477,7 @@
print_typdefs(SmiNode *n)
{
SmiNode *p;
-
+
p = n;
n = smiGetFirstChildNode(n);
while (n != NULL) {
@@ -559,7 +560,11 @@
level = 0;
last = NULL;
for (opt = 0; opt < argc; opt++) {
+ if (mods[opt] == NULL) /* smiGetModule failed above */
+ continue;
n = smiGetFirstNode(mods[opt], SMI_NODEKIND_ANY);
+ if (n == NULL)
+ continue;
for (;;) {
if (do_typedef == 0) {
level = open_node(n, level, &last);
Modified: trunk/contrib/bsnmp/gensnmptree/gensnmptree.1
===================================================================
--- trunk/contrib/bsnmp/gensnmptree/gensnmptree.1 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/gensnmptree/gensnmptree.1 2018-06-19 14:44:12 UTC (rev 11089)
@@ -7,7 +7,7 @@
.\" All rights reserved.
.\"
.\" Author: Harti Brandt <harti at FreeBSD.org>
-.\"
+.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
@@ -16,7 +16,7 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\"
+.\"
.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/gensnmptree/gensnmptree.c
===================================================================
--- trunk/contrib/bsnmp/gensnmptree/gensnmptree.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/gensnmptree/gensnmptree.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -8,7 +8,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -17,7 +17,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -738,15 +738,13 @@
e->value = -(long)val;
} else
e->value = val;
-
+
if (*tok != TOK_NUM)
report("need value for ENUM/BITS");
if (gettoken() != TOK_STR)
report("need string in ENUM/BITS");
- if (e != NULL) {
- e->name = savetok();
- TAILQ_INSERT_TAIL(&t->enums, e, link);
- }
+ e->name = savetok();
+ TAILQ_INSERT_TAIL(&t->enums, e, link);
if ((*tok = gettoken()) == TOK_EOF)
report("unexpected EOF in ENUM/BITS");
} while (*tok != ')');
Modified: trunk/contrib/bsnmp/lib/asn1.3
===================================================================
--- trunk/contrib/bsnmp/lib/asn1.3 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/lib/asn1.3 2018-06-19 14:44:12 UTC (rev 11089)
@@ -5,9 +5,9 @@
.\" Copyright (c) 2001-2003
.\" Fraunhofer Institute for Open Communication Systems (FhG Fokus).
.\" All rights reserved.
-.\"
+.\"
.\" Author: Harti Brandt <harti at FreeBSD.org>
-.\"
+.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
@@ -16,7 +16,7 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\"
+.\"
.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/lib/asn1.c
===================================================================
--- trunk/contrib/bsnmp/lib/asn1.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/lib/asn1.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -285,7 +285,7 @@
enum asn_err ret;
if (ival < 0) {
- /* this may fail if |INT64_MIN| > |INT64_MAX| and
+ /* this may fail if |INT64_MIN| > |INT64_MAX| and
* the value is between * INT64_MIN <= ival < -(INT64_MAX+1) */
val = (uint64_t)-(ival + 1);
neg = 1;
@@ -652,7 +652,7 @@
err = ASN_ERR_RANGE;
}
if (oid->subs[0] > 2 ||
- (oid->subs[0] < 2 && oid->subs[0] >= 40)) {
+ (oid->subs[0] < 2 && oid->subs[1] >= 40)) {
asn_error(NULL, "oid out of range (%u,%u)",
oid->subs[0], oid->subs[1]);
err = ASN_ERR_RANGE;
@@ -890,7 +890,7 @@
memcpy(dest->subs, &src->subs[from], dest->len * sizeof(dest->subs[0]));
}
-/*
+/*
* Append from to to
*/
void
Modified: trunk/contrib/bsnmp/lib/asn1.h
===================================================================
--- trunk/contrib/bsnmp/lib/asn1.h 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/lib/asn1.h 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/lib/bsnmpagent.3
===================================================================
--- trunk/contrib/bsnmp/lib/bsnmpagent.3 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/lib/bsnmpagent.3 2018-06-19 14:44:12 UTC (rev 11089)
@@ -7,7 +7,7 @@
.\" All rights reserved.
.\"
.\" Author: Harti Brandt <harti at FreeBSD.org>
-.\"
+.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
@@ -16,7 +16,7 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\"
+.\"
.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/lib/bsnmpclient.3
===================================================================
--- trunk/contrib/bsnmp/lib/bsnmpclient.3 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/lib/bsnmpclient.3 2018-06-19 14:44:12 UTC (rev 11089)
@@ -7,7 +7,7 @@
.\" All rights reserved.
.\"
.\" Author: Harti Brandt <harti at FreeBSD.org>
-.\"
+.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
@@ -16,7 +16,7 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\"
+.\"
.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -31,7 +31,7 @@
.\"
.\" $Begemot: bsnmp/lib/bsnmpclient.3,v 1.12 2005/10/04 08:46:50 brandt_h Exp $
.\"
-.Dd September 9, 2010
+.Dd December 31, 2016
.Dt BSNMPCLIENT 3
.Os
.Sh NAME
@@ -208,13 +208,13 @@
The default is
.Sq private .
.It Va identifier
-The message indentifier value to be used with SNMPv3 PDUs. Incremented with
+The message identifier value to be used with SNMPv3 PDUs. Incremented with
each transmitted PDU.
.It Va security_model
The security model to be used with SNMPv3 PDUs. Currently only User-Based
Security model specified by RFC 3414 (value 3) is supported.
.It Va engine
-The authorative SNMP engine parameters to be used with SNMPv3 PDUs.
+The authoritive SNMP engine parameters to be used with SNMPv3 PDUs.
.It Va user
The USM SNMP user credentials to be used with SNMPv3 PDUs.
.It Va clen
@@ -368,7 +368,7 @@
and appends the length of the string (as computed by
.Xr strlen 3 )
and each of the characters in the string to the OID.
-.It Li ( Va N Ns Li )
+.It ( Va N Ns )
This format expects no argument.
.Va N
must be a decimal number and is stored into an internal variable
@@ -413,7 +413,7 @@
When a response is received or the retransmission count
is exceeded the callback
.Fa func
-is called with the orignal request PDU, the response PDU and the user argument
+is called with the original request PDU, the response PDU and the user argument
.Fa uarg .
If the retransmit count is exceeded,
.Fa func
@@ -648,7 +648,7 @@
.Pp
The function
.Fn snmp_discover_engine
-is used to discover the authorative snmpEngineId of a remote SNMPv3 agent.
+is used to discover the authoritative snmpEngineId of a remote SNMPv3 agent.
A request PDU with empty USM user name is sent and the client's engine
parameters are set according to the snmpEngine parameters received in the
response PDU.
@@ -656,10 +656,10 @@
snmpEngineBoots and/or snmpEngineTime in the response had zero values, an
additional request (possibly encrypted) with the appropriate user credentials
is sent to fetch the missing values.
-Note, that the function blocks until the discovery proccess is completed.
+Note, that the function blocks until the discovery process is completed.
If no response could be received after all timeouts and retries, or the
response contained errors the function returns -1.
-If the discovery proccess was completed 0 is returned.
+If the discovery process was completed 0 is returned.
.Pp
The function
.Fn snmp_parse_server
Modified: trunk/contrib/bsnmp/lib/bsnmplib.3
===================================================================
--- trunk/contrib/bsnmp/lib/bsnmplib.3 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/lib/bsnmplib.3 2018-06-19 14:44:12 UTC (rev 11089)
@@ -13,7 +13,7 @@
.\" All rights reserved.
.\"
.\" Author: Harti Brandt <harti at FreeBSD.org>
-.\"
+.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
@@ -22,7 +22,7 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\"
+.\"
.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -37,7 +37,7 @@
.\"
.\" $Begemot: bsnmp/lib/bsnmplib.3,v 1.9 2005/10/04 08:46:51 brandt_h Exp $
.\"
-.Dd December 19, 2010
+.Dd December 31, 2016
.Dt BSNMPLIB 3
.Os
.Sh NAME
@@ -161,7 +161,6 @@
.Fa v.octetstring.octets
points to a string allocated by
.Xr malloc 3 .
-.Pp
.Bd -literal -offset indent
#define SNMP_ENGINE_ID_SIZ 32
@@ -176,7 +175,6 @@
.Pp
This structure represents an SNMP engine as specified by the SNMP Management
Architecture described in RFC 3411.
-.Pp
.Bd -literal -offset indent
#define SNMP_ADM_STR32_SIZ (32 + 1)
#define SNMP_AUTH_KEY_SIZ 40
@@ -225,7 +223,6 @@
and
.Fa priv_key
contain the authentication and privacy keys for the user.
-.Pp
.Bd -literal -offset indent
#define SNMP_COMMUNITY_MAXLEN 128
#define SNMP_MAX_BINDINGS 100
@@ -384,12 +381,12 @@
verifies the authentication parameter contained in the PDU (if present) and
if the PDU is encrypted, decrypts the PDU contents pointed to by
.Fa buf .
-If successfull, a plain text scoped PDU is stored in the buffer.
+If successful, a plain text scoped PDU is stored in the buffer.
.Pp
The function
.Fn snmp_pdu_init_secparams
calculates the initialization vector for the privacy protocol in use before
-the PDU pointed to by
+the PDU pointed to by
.Fa pdu
may be encrypted or decrypted.
.Pp
@@ -480,7 +477,7 @@
The PDU authentication parameter received in the PDU did not match the
calculated message digest.
.It Bq Er SNMP_CODE_EDECRYPT
-Error occured while trying to decrypt the PDU.
+Error occurred while trying to decrypt the PDU.
.El
.Pp
.Fn snmp_pdu_encode
@@ -504,7 +501,7 @@
The library may optionally be built without references to the
.Xr crypto 3
library. In such case only plain text SNMPv3 PDUs without message digests
-may be proccessed correctly.
+may be proccessed correctly.
.Sh STANDARDS
This implementation conforms to the applicable IETF RFCs and ITU-T
recommendations.
Modified: trunk/contrib/bsnmp/lib/snmp.c
===================================================================
--- trunk/contrib/bsnmp/lib/snmp.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/lib/snmp.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Copyright (c) 2010 The FreeBSD Foundation
* All rights reserved.
*
@@ -19,7 +19,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -38,19 +38,21 @@
*/
#include <sys/types.h>
#include <sys/socket.h>
+#include <ctype.h>
+#include <errno.h>
+#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdarg.h>
+#include <string.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#elif defined(HAVE_INTTYPES_H)
#include <inttypes.h>
#endif
-#include <string.h>
-#include <ctype.h>
-#include <netdb.h>
-#include <errno.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
#include "asn1.h"
#include "snmp.h"
@@ -288,11 +290,13 @@
memset(buf, 0, 256);
tb.asn_ptr = buf;
tb.asn_len = 256;
+ u_int len;
- if (asn_get_octetstring(b, buf, &tb.asn_len) != ASN_ERR_OK) {
+ if (asn_get_octetstring(b, buf, &len) != ASN_ERR_OK) {
snmp_error("cannot parse usm header");
return (ASN_ERR_FAILED);
}
+ tb.asn_len = len;
if (asn_get_sequence(&tb, &octs_len) != ASN_ERR_OK) {
snmp_error("cannot decode usm header");
@@ -353,8 +357,8 @@
pdu_encode_secparams(struct asn_buf *b, struct snmp_pdu *pdu)
{
u_char buf[256], *sptr;
- struct asn_buf tb;
- size_t auth_off, moved = 0;
+ struct asn_buf tb;
+ size_t auth_off, moved = 0;
auth_off = 0;
memset(buf, 0, 256);
@@ -680,7 +684,7 @@
struct asn_buf b = *b0;
/* <0x10|0x20> <len> <data...> */
-
+
if (b.asn_len == 0)
return (0);
if (b.asn_cptr[0] != (ASN_TYPE_SEQUENCE | ASN_TYPE_CONSTRUCTED)) {
@@ -755,7 +759,7 @@
if (asn_put_temp_header(b, (ASN_TYPE_SEQUENCE |
ASN_TYPE_CONSTRUCTED), &v3_hdr_ptr) != ASN_ERR_OK)
return (SNMP_CODE_FAILED);
-
+
if (asn_put_integer(b, pdu->identifier) != ASN_ERR_OK)
return (SNMP_CODE_FAILED);
@@ -864,7 +868,7 @@
return (SNMP_CODE_FAILED);
pdu->scoped_len = b->asn_ptr - pdu->scoped_ptr;
- if ((code = snmp_pdu_fix_padd(b, pdu))!= ASN_ERR_OK)
+ if (snmp_pdu_fix_padd(b, pdu) != ASN_ERR_OK)
return (SNMP_CODE_FAILED);
if (pdu->security_model != SNMP_SECMODEL_USM)
@@ -997,7 +1001,7 @@
if ((err = snmp_pdu_encode_header(resp_b, pdu)) != SNMP_CODE_OK)
return (err);
for (idx = 0; idx < pdu->nbindings; idx++)
- if ((err = snmp_binding_encode(resp_b, &pdu->bindings[idx]))
+ if (snmp_binding_encode(resp_b, &pdu->bindings[idx])
!= ASN_ERR_OK)
return (SNMP_CODE_FAILED);
@@ -1150,8 +1154,11 @@
void
snmp_value_free(struct snmp_value *value)
{
- if (value->syntax == SNMP_SYNTAX_OCTETSTRING)
+
+ if (value->syntax == SNMP_SYNTAX_OCTETSTRING) {
free(value->v.octetstring.octets);
+ value->v.octetstring.octets = NULL;
+ }
value->syntax = SNMP_SYNTAX_NULL;
}
@@ -1212,6 +1219,7 @@
for (i = 0; i < pdu->nbindings; i++)
snmp_value_free(&pdu->bindings[i]);
+ pdu->nbindings = 0;
}
/*
@@ -1382,29 +1390,16 @@
case SNMP_SYNTAX_IPADDRESS:
{
struct hostent *he;
- u_long ip[4];
- int n;
- if (sscanf(str, "%lu.%lu.%lu.%lu%n", &ip[0], &ip[1], &ip[2],
- &ip[3], &n) == 4 && (size_t)n == strlen(str) &&
- ip[0] <= 0xff && ip[1] <= 0xff &&
- ip[2] <= 0xff && ip[3] <= 0xff) {
- v->ipaddress[0] = (u_char)ip[0];
- v->ipaddress[1] = (u_char)ip[1];
- v->ipaddress[2] = (u_char)ip[2];
- v->ipaddress[3] = (u_char)ip[3];
+ if (inet_pton(AF_INET, str, &v->ipaddress) == 1)
return (0);
- }
-
- if ((he = gethostbyname(str)) == NULL)
+ if ((he = gethostbyname2(str, AF_INET)) == NULL)
return (-1);
if (he->h_addrtype != AF_INET)
return (-1);
- v->ipaddress[0] = he->h_addr[0];
- v->ipaddress[1] = he->h_addr[1];
- v->ipaddress[2] = he->h_addr[2];
- v->ipaddress[3] = he->h_addr[3];
+ memcpy(v->ipaddress, he->h_addr, sizeof(v->ipaddress));
+
return (0);
}
Modified: trunk/contrib/bsnmp/lib/snmp.h
===================================================================
--- trunk/contrib/bsnmp/lib/snmp.h 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/lib/snmp.h 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Copyright (c) 2010 The FreeBSD Foundation
* All rights reserved.
*
@@ -11,7 +11,7 @@
* Portions of this software were developed by Shteryana Sotirova Shopova
* under sponsorship from the FreeBSD Foundation.
*
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -20,7 +20,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -182,7 +182,7 @@
/* fixes for encoding */
size_t outer_len;
- size_t scoped_len;
+ asn_len_t scoped_len;
u_char *outer_ptr;
u_char *digest_ptr;
u_char *encrypted_ptr;
Modified: trunk/contrib/bsnmp/lib/snmpagent.c
===================================================================
--- trunk/contrib/bsnmp/lib/snmpagent.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/lib/snmpagent.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -166,7 +166,7 @@
}
static void
-snmp_pdu_create_response(struct snmp_pdu *pdu, struct snmp_pdu *resp)
+snmp_pdu_create_response(const struct snmp_pdu *pdu, struct snmp_pdu *resp)
{
memset(resp, 0, sizeof(*resp));
strcpy(resp->community, pdu->community);
@@ -276,7 +276,12 @@
}
}
- return (snmp_fix_encoding(resp_b, resp));
+ if (snmp_fix_encoding(resp_b, resp) != SNMP_CODE_OK) {
+ snmp_debug("get: failed to encode PDU");
+ return (SNMP_RET_ERR);
+ }
+
+ return (SNMP_RET_OK);
}
static struct snmp_node *
@@ -438,7 +443,13 @@
return (SNMP_RET_ERR);
}
}
- return (snmp_fix_encoding(resp_b, resp));
+
+ if (snmp_fix_encoding(resp_b, resp) != SNMP_CODE_OK) {
+ snmp_debug("getnext: failed to encode PDU");
+ return (SNMP_RET_ERR);
+ }
+
+ return (SNMP_RET_OK);
}
enum snmp_ret
@@ -504,7 +515,7 @@
/* PDU is full */
goto done;
- if (cnt == 0)
+ if (cnt == 0)
result = do_getnext(&context, &pdu->bindings[i],
&resp->bindings[resp->nbindings], pdu);
else
@@ -542,7 +553,12 @@
}
done:
- return (snmp_fix_encoding(resp_b, resp));
+ if (snmp_fix_encoding(resp_b, resp) != SNMP_CODE_OK) {
+ snmp_debug("getnext: failed to encode PDU");
+ return (SNMP_RET_ERR);
+ }
+
+ return (SNMP_RET_OK);
}
/*
@@ -673,7 +689,7 @@
if (snmp_pdu_encode_header(resp_b, resp))
return (SNMP_RET_IGN);
- /*
+ /*
* 1. Find all nodes, check that they are writeable and
* that the syntax is ok, copy over the binding to the response.
*/
@@ -951,25 +967,64 @@
/*
* Make an error response from a PDU. We do this without decoding the
* variable bindings. This means we can sent the junk back to a caller
- * that has sent us junk in the first place.
+ * that has sent us junk in the first place.
*/
enum snmp_ret
snmp_make_errresp(const struct snmp_pdu *pdu, struct asn_buf *pdu_b,
struct asn_buf *resp_b)
{
+ u_char type;
asn_len_t len;
struct snmp_pdu resp;
enum asn_err err;
enum snmp_code code;
- memset(&resp, 0, sizeof(resp));
+ snmp_pdu_create_response(pdu, &resp);
+
if ((code = snmp_pdu_decode_header(pdu_b, &resp)) != SNMP_CODE_OK)
return (SNMP_RET_IGN);
- if (pdu_b->asn_len < len)
+ if (pdu->version == SNMP_V3) {
+ if (resp.user.priv_proto != SNMP_PRIV_NOPRIV &&
+ (asn_get_header(pdu_b, &type, &resp.scoped_len) != ASN_ERR_OK
+ || type != ASN_TYPE_OCTETSTRING)) {
+ snmp_error("cannot decode encrypted pdu");
+ return (SNMP_RET_IGN);
+ }
+
+ if (asn_get_sequence(pdu_b, &len) != ASN_ERR_OK) {
+ snmp_error("cannot decode scoped pdu header");
+ return (SNMP_RET_IGN);
+ }
+
+ len = SNMP_ENGINE_ID_SIZ;
+ if (asn_get_octetstring(pdu_b, (u_char *)resp.context_engine,
+ &len) != ASN_ERR_OK) {
+ snmp_error("cannot decode msg context engine");
+ return (SNMP_RET_IGN);
+ }
+ resp.context_engine_len = len;
+ len = SNMP_CONTEXT_NAME_SIZ;
+ if (asn_get_octetstring(pdu_b, (u_char *)resp.context_name,
+ &len) != ASN_ERR_OK) {
+ snmp_error("cannot decode msg context name");
+ return (SNMP_RET_IGN);
+ }
+ resp.context_name[len] = '\0';
+ }
+
+
+ if (asn_get_header(pdu_b, &type, &len) != ASN_ERR_OK) {
+ snmp_error("cannot get pdu header");
return (SNMP_RET_IGN);
- pdu_b->asn_len = len;
+ }
+ if ((type & ~ASN_TYPE_MASK) !=
+ (ASN_TYPE_CONSTRUCTED | ASN_CLASS_CONTEXT)) {
+ snmp_error("bad pdu header tag");
+ return (SNMP_RET_IGN);
+ }
+
err = snmp_parse_pdus_hdr(pdu_b, &resp, &len);
if (ASN_ERR_STOPPED(err))
return (SNMP_RET_IGN);
Modified: trunk/contrib/bsnmp/lib/snmpagent.h
===================================================================
--- trunk/contrib/bsnmp/lib/snmpagent.h 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/lib/snmpagent.h 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/lib/snmpclient.c
===================================================================
--- trunk/contrib/bsnmp/lib/snmpclient.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/lib/snmpclient.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -8,7 +8,7 @@
*
* Author: Harti Brandt <harti at freebsd.org>
* Kendy Kutzner
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -17,7 +17,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -68,7 +68,7 @@
struct snmp_client snmp_client;
/* List of all outstanding requests */
-struct sent_pdu {
+struct sent_pdu {
int reqid;
struct snmp_pdu *pdu;
struct timeval time;
@@ -510,7 +510,7 @@
table_free(work, 1);
return (-2);
}
-
+
continue;
}
if (!asn_is_suboid(&work->descr->table, &b->var) ||
@@ -728,8 +728,11 @@
work->last_change = 0;
table_init_pdu(descr, &work->pdu);
- if (snmp_pdu_send(&work->pdu, table_cb, work) == -1)
+ if (snmp_pdu_send(&work->pdu, table_cb, work) == -1) {
+ free(work);
+ work = NULL;
return (-1);
+ }
return (0);
}
@@ -754,7 +757,7 @@
ret = 0;
while (*fmt != '\0') {
switch (*fmt++) {
- case 'i':
+ case 'i':
/* just an integer more */
if (oid->len + 1 > ASN_MAXOIDLEN) {
warnx("%s: OID too long for integer", __func__);
@@ -804,7 +807,7 @@
break;
case 'b':
- /* append `size` characters */
+ /* append `size` characters */
str = (const u_char *)va_arg(va, const char *);
if (oid->len + size > ASN_MAXOIDLEN) {
warnx("%s: OID too long for string", __func__);
@@ -852,7 +855,7 @@
strcpy(c->read_community, "public");
strcpy(c->write_community, "private");
-
+
c->security_model = SNMP_SECMODEL_USM;
strcpy(c->cname, "");
@@ -863,7 +866,7 @@
c->txbuflen = c->rxbuflen = 10000;
c->fd = -1;
-
+
c->max_reqid = INT32_MAX;
c->min_reqid = 0;
c->next_reqid = 0;
@@ -944,6 +947,8 @@
if ((res = res->ai_next) == NULL) {
seterr(&snmp_client, "%s", strerror(errno));
freeaddrinfo(res0);
+ (void)close(snmp_client.fd);
+ snmp_client.fd = -1;
return (-1);
}
} else
@@ -1063,13 +1068,13 @@
switch (snmp_client.trans) {
case SNMP_TRANS_UDP:
- if (open_client_udp(host, port))
+ if (open_client_udp(host, port) != 0)
return (-1);
break;
case SNMP_TRANS_LOC_DGRAM:
case SNMP_TRANS_LOC_STREAM:
- if (open_client_local(host))
+ if (open_client_local(host) != 0)
return (-1);
break;
@@ -1214,7 +1219,7 @@
int32_t i;
i = c->next_reqid;
- if (c->next_reqid >= c->max_reqid)
+ if (c->next_reqid >= c->max_reqid)
c->next_reqid = c->min_reqid;
else
c->next_reqid++;
@@ -1230,33 +1235,33 @@
u_char *buf;
struct asn_buf b;
ssize_t ret;
-
- if ((buf = malloc(snmp_client.txbuflen)) == NULL) {
+
+ if ((buf = calloc(1, snmp_client.txbuflen)) == NULL) {
seterr(&snmp_client, "%s", strerror(errno));
return (-1);
}
- pdu->request_id = snmp_next_reqid(&snmp_client);
+ pdu->request_id = snmp_next_reqid(&snmp_client);
- b.asn_ptr = buf;
- b.asn_len = snmp_client.txbuflen;
- if (snmp_pdu_encode(pdu, &b)) {
+ b.asn_ptr = buf;
+ b.asn_len = snmp_client.txbuflen;
+ if (snmp_pdu_encode(pdu, &b)) {
seterr(&snmp_client, "%s", strerror(errno));
free(buf);
return (-1);
}
- if (snmp_client.dump_pdus)
- snmp_pdu_dump(pdu);
+ if (snmp_client.dump_pdus)
+ snmp_pdu_dump(pdu);
- if ((ret = send(snmp_client.fd, buf, b.asn_ptr - buf, 0)) == -1) {
+ if ((ret = send(snmp_client.fd, buf, b.asn_ptr - buf, 0)) == -1) {
seterr(&snmp_client, "%s", strerror(errno));
free(buf);
- return (-1);
+ return (-1);
}
free(buf);
- return pdu->request_id;
+ return (pdu->request_id);
}
/*
@@ -1269,7 +1274,7 @@
#if 0
warnx("snmp request %i timed out, attempt (%i/%i)",
- listentry->reqid, listentry->retrycount, snmp_client.retries);
+ listentry->reqid, listentry->retrycount, snmp_client.retries);
#endif
listentry->retrycount++;
@@ -1314,7 +1319,7 @@
listentry->callback = func;
listentry->arg = arg;
listentry->retrycount=1;
- listentry->timeout_id =
+ listentry->timeout_id =
snmp_client.timeout_start(&snmp_client.timeout, snmp_timeout,
listentry);
@@ -1352,7 +1357,7 @@
socklen_t optlen;
#endif
- if ((buf = malloc(snmp_client.rxbuflen)) == NULL) {
+ if ((buf = calloc(1, snmp_client.rxbuflen)) == NULL) {
seterr(&snmp_client, "%s", strerror(errno));
return (-1);
}
@@ -1463,7 +1468,7 @@
return (+1);
}
-static int
+static int
snmp_deliver_packet(struct snmp_pdu * resp)
{
struct sent_pdu *listentry;
@@ -1548,7 +1553,7 @@
&resp->bindings[i].var)) {
if (i != 0)
warnx("SNMP GETNEXT: inconsistent table "
- "response");
+ "response");
return (0);
}
if (resp->version != SNMP_V1 &&
@@ -1654,7 +1659,7 @@
/*
* Simple checks for response PDUs against request PDUs. Return values: 1=ok,
- * 0=nosuchname or similar, -1=failure, -2=no response at all
+ * 0=nosuchname or similar, -1=failure, -2=no response at all
*/
int
snmp_pdu_check(const struct snmp_pdu *req,
@@ -1681,12 +1686,12 @@
int
snmp_dialog(struct snmp_v1_pdu *req, struct snmp_v1_pdu *resp)
{
- u_int i;
- int32_t reqid;
- int ret;
- struct timeval tv = snmp_client.timeout;
+ struct timeval tv = snmp_client.timeout;
struct timeval end;
struct snmp_pdu pdu;
+ int ret;
+ int32_t reqid;
+ u_int i;
/*
* Make a copy of the request and replace the syntaxes by NULL
@@ -1698,11 +1703,11 @@
for (i = 0; i < pdu.nbindings; i++)
pdu.bindings[i].syntax = SNMP_SYNTAX_NULL;
}
-
- for (i = 0; i <= snmp_client.retries; i++) {
+
+ for (i = 0; i <= snmp_client.retries; i++) {
(void)gettimeofday(&end, NULL);
timeradd(&end, &snmp_client.timeout, &end);
- if ((reqid = snmp_send_packet(&pdu)) == -1)
+ if ((reqid = snmp_send_packet(&pdu)) == -1)
return (-1);
for (;;) {
(void)gettimeofday(&tv, NULL);
@@ -1717,16 +1722,16 @@
if (reqid == resp->request_id)
return (0);
/* not for us */
- (void)snmp_deliver_packet(resp);
+ (void)snmp_deliver_packet(resp);
}
if (ret < 0 && errno == EPIPE)
/* stream closed */
return (-1);
}
- }
+ }
errno = ETIMEDOUT;
seterr(&snmp_client, "retry count exceeded");
- return (-1);
+ return (-1);
}
int
@@ -1793,12 +1798,14 @@
return (0);
}
+ snmp_pdu_free(&req);
+
snmp_pdu_create(&req, SNMP_PDU_GET);
req.engine.engine_boots = 0;
req.engine.engine_time = 0;
if (snmp_dialog(&req, &resp) == -1)
- return (-1);
+ return (-1);
if (resp.version != req.version) {
seterr(&snmp_client, "wrong version");
@@ -1813,6 +1820,9 @@
snmp_client.engine.engine_boots = resp.engine.engine_boots;
snmp_client.engine.engine_time = resp.engine.engine_time;
+ snmp_pdu_free(&req);
+ snmp_pdu_free(&resp);
+
return (0);
}
@@ -1937,20 +1947,18 @@
}
/* port */
free(sc->cport);
- if ((sc->cport = malloc(strlen(p + 1) + 1)) == NULL) {
+ if ((sc->cport = strdup(p + 1)) == NULL) {
seterr(sc, "%s", strerror(errno));
return (-1);
}
- strcpy(sc->cport, p + 1);
} else if (p > s) {
/* host */
free(sc->chost);
- if ((sc->chost = malloc(strlen(s) + 1)) == NULL) {
+ if ((sc->chost = strdup(s)) == NULL) {
seterr(sc, "%s", strerror(errno));
return (-1);
}
- strcpy(sc->chost, s);
}
return (0);
}
Modified: trunk/contrib/bsnmp/lib/snmpclient.h
===================================================================
--- trunk/contrib/bsnmp/lib/snmpclient.h 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/lib/snmpclient.h 2018-06-19 14:44:12 UTC (rev 11089)
@@ -5,7 +5,7 @@
*
* Author: Harti Brandt <harti at freebsd.org>
* Kendy Kutzner
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -14,7 +14,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -59,7 +59,7 @@
typedef void (*snmp_timeout_cb_f)(void * );
/* timeout start function */
-typedef void *(*snmp_timeout_start_f)(struct timeval *timeout,
+typedef void *(*snmp_timeout_start_f)(struct timeval *timeout,
snmp_timeout_cb_f callback, void *);
/* timeout stop function */
Modified: trunk/contrib/bsnmp/lib/snmpcrypto.c
===================================================================
--- trunk/contrib/bsnmp/lib/snmpcrypto.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/lib/snmpcrypto.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/contrib/bsnmp/lib/snmpcrypto.c 310903 2016-12-31 10:34:09Z ngie $
*/
#include <sys/types.h>
#include <sys/socket.h>
@@ -322,7 +322,7 @@
for (i = 0; i < keylen / 4; i++)
rvalue[i] = random();
-
+
memcpy(keychange, user->auth_key, keylen);
memcpy(keychange + keylen, rvalue, keylen);
@@ -366,7 +366,7 @@
return (SNMP_CODE_OK);
}
-int
+enum snmp_code
snmp_passwd_to_keys(struct snmp_user *user, char *passwd __unused)
{
if (user->auth_proto == SNMP_AUTH_NOAUTH &&
@@ -378,7 +378,7 @@
return (SNMP_CODE_FAILED);
}
-int
+enum snmp_code
snmp_get_local_keys(struct snmp_user *user, uint8_t *eid __unused,
uint32_t elen __unused)
{
Modified: trunk/contrib/bsnmp/lib/snmppriv.h
===================================================================
--- trunk/contrib/bsnmp/lib/snmppriv.h 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/lib/snmppriv.h 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/lib/support.c
===================================================================
--- trunk/contrib/bsnmp/lib/support.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/lib/support.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -1,10 +1,10 @@
-/*
+/*
* Copyright (C) 2004
* Hartmut Brandt.
* All rights reserved.
- *
+ *
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/lib/support.h
===================================================================
--- trunk/contrib/bsnmp/lib/support.h 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/lib/support.h 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/lib/tc.def
===================================================================
--- trunk/contrib/bsnmp/lib/tc.def 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/lib/tc.def 2018-06-19 14:44:12 UTC (rev 11089)
@@ -26,7 +26,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $MidnightBSD$
+# $FreeBSD$
#
typedef RowStatus ENUM (
Modified: trunk/contrib/bsnmp/snmp_mibII/BEGEMOT-IP-MIB.txt
===================================================================
--- trunk/contrib/bsnmp/snmp_mibII/BEGEMOT-IP-MIB.txt 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_mibII/BEGEMOT-IP-MIB.txt 2018-06-19 14:44:12 UTC (rev 11089)
@@ -54,6 +54,9 @@
E-mail: harti at freebsd.org"
DESCRIPTION
"The MIB for IP stuff that is not in the official IP MIBs."
+ REVISION "200602130000Z"
+ DESCRIPTION
+ "Initial revision."
::= { begemot 3 }
begemotIpObjects OBJECT IDENTIFIER ::= { begemotIp 1 }
Modified: trunk/contrib/bsnmp/snmp_mibII/mibII.c
===================================================================
--- trunk/contrib/bsnmp/snmp_mibII/mibII.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_mibII/mibII.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -204,7 +204,7 @@
return;
if ((d = malloc(sizeof(*d))) == NULL)
err(1, NULL);
- strcpy(d->name, name);
+ strlcpy(d->name, name, sizeof(d->name));
SLIST_INSERT_HEAD(&mibdynif_list, d, link);
}
@@ -265,7 +265,7 @@
{
struct ifreq ifr;
- strncpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
+ strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
if (ioctl(mib_netsock, SIOCGIFFLAGS, &ifr) == -1) {
syslog(LOG_ERR, "SIOCGIFFLAGS(%s): %m", ifp->name);
return (-1);
@@ -319,7 +319,7 @@
name[5] = IFDATA_GENERAL;
len = sizeof(ifp->mib);
- if (sysctl(name, 6, &ifp->mib, &len, NULL, 0) == -1) {
+ if (sysctl(name, nitems(name), &ifp->mib, &len, NULL, 0) == -1) {
if (errno != ENOENT)
syslog(LOG_WARNING, "sysctl(ifmib, %s) failed %m",
ifp->name);
@@ -443,6 +443,7 @@
size_t len;
void *newmib;
struct ifmibdata oldmib = ifp->mib;
+ struct ifreq irr;
if (fetch_generic_mib(ifp, &oldmib) == -1)
return (-1);
@@ -479,7 +480,7 @@
name[3] = IFMIB_IFDATA;
name[4] = ifp->sysindex;
name[5] = IFDATA_LINKSPECIFIC;
- if (sysctl(name, 6, NULL, &len, NULL, 0) == -1) {
+ if (sysctl(name, nitems(name), NULL, &len, NULL, 0) == -1) {
syslog(LOG_WARNING, "sysctl linkmib estimate (%s): %m",
ifp->name);
if (ifp->specmib != NULL) {
@@ -505,7 +506,7 @@
ifp->specmib = newmib;
ifp->specmiblen = len;
}
- if (sysctl(name, 6, ifp->specmib, &len, NULL, 0) == -1) {
+ if (sysctl(name, nitems(name), ifp->specmib, &len, NULL, 0) == -1) {
syslog(LOG_WARNING, "sysctl linkmib (%s): %m", ifp->name);
if (ifp->specmib != NULL) {
ifp->specmib = NULL;
@@ -514,6 +515,18 @@
}
out:
+ strlcpy(irr.ifr_name, ifp->name, sizeof(irr.ifr_name));
+ irr.ifr_buffer.buffer = MIBIF_PRIV(ifp)->alias;
+ irr.ifr_buffer.length = sizeof(MIBIF_PRIV(ifp)->alias);
+ if (ioctl(mib_netsock, SIOCGIFDESCR, &irr) == -1) {
+ MIBIF_PRIV(ifp)->alias[0] = 0;
+ if (errno != ENOMSG)
+ syslog(LOG_WARNING, "SIOCGIFDESCR (%s): %m", ifp->name);
+ } else if (irr.ifr_buffer.buffer == NULL) {
+ MIBIF_PRIV(ifp)->alias[0] = 0;
+ syslog(LOG_WARNING, "SIOCGIFDESCR (%s): too long (%zu)",
+ ifp->name, irr.ifr_buffer.length);
+ }
ifp->mibtick = get_ticks();
return (0);
}
@@ -694,10 +707,11 @@
}
free(ifp->private);
- if (ifp->physaddr != NULL)
- free(ifp->physaddr);
- if (ifp->specmib != NULL)
- free(ifp->specmib);
+ ifp->private = NULL;
+ free(ifp->physaddr);
+ ifp->physaddr = NULL;
+ free(ifp->specmib);
+ ifp->specmib = NULL;
STAILQ_FOREACH(map, &mibindexmap_list, link)
if (map->mibif == ifp) {
@@ -732,8 +746,8 @@
at = at1;
}
-
free(ifp);
+ ifp = NULL;
mib_if_number--;
mib_iftable_last_change = this_tick;
}
@@ -760,8 +774,8 @@
memset(ifp->private, 0, sizeof(struct mibif_private));
ifp->sysindex = sysindex;
- strcpy(ifp->name, name);
- strcpy(ifp->descr, name);
+ strlcpy(ifp->name, name, sizeof(ifp->name));
+ strlcpy(ifp->descr, name, sizeof(ifp->descr));
ifp->spec_oid = oid_zeroDotZero;
map = NULL;
@@ -888,7 +902,7 @@
for (idx = 1; idx <= count; idx++) {
name[4] = idx;
len = sizeof(mib);
- if (sysctl(name, 6, &mib, &len, NULL, 0) == -1) {
+ if (sysctl(name, nitems(name), &mib, &len, NULL, 0) == -1) {
if (errno == ENOENT)
continue;
syslog(LOG_ERR, "ifmib(%u): %m", idx);
@@ -934,6 +948,34 @@
}
/*
+ * Process a new ARP entry
+ */
+static void
+process_arp(const struct rt_msghdr *rtm, const struct sockaddr_dl *sdl,
+ const struct sockaddr_in *sa)
+{
+ struct mibif *ifp;
+ struct mibarp *at;
+
+ /* IP arp table entry */
+ if (sdl->sdl_alen == 0)
+ return;
+ if ((ifp = mib_find_if_sys(sdl->sdl_index)) == NULL)
+ return;
+ /* have a valid entry */
+ if ((at = mib_find_arp(ifp, sa->sin_addr)) == NULL &&
+ (at = mib_arp_create(ifp, sa->sin_addr,
+ sdl->sdl_data + sdl->sdl_nlen, sdl->sdl_alen)) == NULL)
+ return;
+
+ if (rtm->rtm_rmx.rmx_expire == 0)
+ at->flags |= MIBARP_PERM;
+ else
+ at->flags &= ~MIBARP_PERM;
+ at->flags |= MIBARP_FOUND;
+}
+
+/*
* Handle a routing socket message.
*/
static void
@@ -941,7 +983,7 @@
{
struct sockaddr *addrs[RTAX_MAX];
struct if_msghdr *ifm;
- struct ifa_msghdr *ifam;
+ struct ifa_msghdr ifam, *ifamp;
struct ifma_msghdr *ifmam;
#ifdef RTM_IFANNOUNCE
struct if_announcemsghdr *ifan;
@@ -961,8 +1003,9 @@
switch (rtm->rtm_type) {
case RTM_NEWADDR:
- ifam = (struct ifa_msghdr *)rtm;
- mib_extract_addrs(ifam->ifam_addrs, (u_char *)(ifam + 1), addrs);
+ ifamp = (struct ifa_msghdr *)rtm;
+ memcpy(&ifam, ifamp, sizeof(ifam));
+ mib_extract_addrs(ifam.ifam_addrs, (u_char *)(ifamp + 1), addrs);
if (addrs[RTAX_IFA] == NULL || addrs[RTAX_NETMASK] == NULL)
break;
@@ -969,9 +1012,9 @@
sa = (struct sockaddr_in *)(void *)addrs[RTAX_IFA];
if ((ifa = mib_find_ifa(sa->sin_addr)) == NULL) {
/* unknown address */
- if ((ifp = mib_find_if_sys(ifam->ifam_index)) == NULL) {
+ if ((ifp = mib_find_if_sys(ifam.ifam_index)) == NULL) {
syslog(LOG_WARNING, "RTM_NEWADDR for unknown "
- "interface %u", ifam->ifam_index);
+ "interface %u", ifam.ifam_index);
break;
}
if ((ifa = alloc_ifa(ifp->index, sa->sin_addr)) == NULL)
@@ -988,8 +1031,9 @@
break;
case RTM_DELADDR:
- ifam = (struct ifa_msghdr *)rtm;
- mib_extract_addrs(ifam->ifam_addrs, (u_char *)(ifam + 1), addrs);
+ ifamp = (struct ifa_msghdr *)rtm;
+ memcpy(&ifam, ifamp, sizeof(ifam));
+ mib_extract_addrs(ifam.ifam_addrs, (u_char *)(ifamp + 1), addrs);
if (addrs[RTAX_IFA] == NULL)
break;
@@ -1075,6 +1119,23 @@
#endif
case RTM_GET:
case RTM_ADD:
+ mib_extract_addrs(rtm->rtm_addrs, (u_char *)(rtm + 1), addrs);
+ if (rtm->rtm_flags & RTF_LLINFO) {
+ if (addrs[RTAX_DST] == NULL ||
+ addrs[RTAX_GATEWAY] == NULL ||
+ addrs[RTAX_DST]->sa_family != AF_INET ||
+ addrs[RTAX_GATEWAY]->sa_family != AF_LINK)
+ break;
+ process_arp(rtm,
+ (struct sockaddr_dl *)(void *)addrs[RTAX_GATEWAY],
+ (struct sockaddr_in *)(void *)addrs[RTAX_DST]);
+ } else {
+ if (rtm->rtm_errno == 0 && (rtm->rtm_flags & RTF_UP))
+ mib_sroute_process(rtm, addrs[RTAX_GATEWAY],
+ addrs[RTAX_DST], addrs[RTAX_NETMASK]);
+ }
+ break;
+
case RTM_DELETE:
mib_extract_addrs(rtm->rtm_addrs, (u_char *)(rtm + 1), addrs);
@@ -1152,7 +1213,7 @@
*lenp = 0;
/* initial estimate */
- if (sysctl(name, 6, NULL, lenp, NULL, 0) == -1) {
+ if (sysctl(name, nitems(name), NULL, lenp, NULL, 0) == -1) {
syslog(LOG_ERR, "sysctl estimate (%d,%d,%d,%d,%d,%d): %m",
name[0], name[1], name[2], name[3], name[4], name[5]);
return (NULL);
@@ -1168,8 +1229,8 @@
return (NULL);
}
buf = newbuf;
-
- if (sysctl(name, 6, buf, lenp, NULL, 0) == 0)
+
+ if (sysctl(name, nitems(name), buf, lenp, NULL, 0) == 0)
break;
if (errno != ENOMEM) {
@@ -1248,8 +1309,7 @@
/*
* Update arp table
- *
-*/
+ */
void
mib_arp_update(void)
{
@@ -1269,7 +1329,7 @@
in_update_arp = 0;
return;
}
-
+
next = buf;
while (next < buf + needed) {
rtm = (struct rt_msghdr *)(void *)next;
@@ -1291,7 +1351,7 @@
/*
- * Intput on the routing socket.
+ * Input on the routing socket.
*/
static void
route_input(int fd, void *udata __unused)
@@ -1324,7 +1384,7 @@
struct sockaddr_in *sa;
memset(&addreq, 0, sizeof(addreq));
- strncpy(addreq.ifra_name, ifname, sizeof(addreq.ifra_name));
+ strlcpy(addreq.ifra_name, ifname, sizeof(addreq.ifra_name));
sa = (struct sockaddr_in *)(void *)&addreq.ifra_addr;
sa->sin_family = AF_INET;
@@ -1354,7 +1414,7 @@
struct sockaddr_in *sa;
memset(&delreq, 0, sizeof(delreq));
- strncpy(delreq.ifr_name, ifname, sizeof(delreq.ifr_name));
+ strlcpy(delreq.ifr_name, ifname, sizeof(delreq.ifr_name));
sa = (struct sockaddr_in *)(void *)&delreq.ifr_addr;
sa->sin_family = AF_INET;
sa->sin_len = sizeof(*sa);
@@ -1373,7 +1433,7 @@
struct sockaddr_in *sa;
memset(&req, 0, sizeof(req));
- strncpy(req.ifr_name, name, sizeof(req.ifr_name));
+ strlcpy(req.ifr_name, name, sizeof(req.ifr_name));
sa = (struct sockaddr_in *)(void *)&req.ifr_addr;
sa->sin_family = AF_INET;
sa->sin_len = sizeof(*sa);
@@ -1461,7 +1521,7 @@
}
/*
- * Modify an IFA.
+ * Modify an IFA.
*/
int
mib_modify_ifa(struct mibifa *ifa)
Modified: trunk/contrib/bsnmp/snmp_mibII/mibII.h
===================================================================
--- trunk/contrib/bsnmp/snmp_mibII/mibII.h 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_mibII/mibII.h 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -36,6 +36,7 @@
#include <sys/sockio.h>
#include <sys/syslog.h>
#include <sys/time.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -56,6 +57,9 @@
#include "snmp_mibII.h"
#include "mibII_tree.h"
+/* maximum size of the interface alias */
+#define MIBIF_ALIAS_SIZE (64 + 1)
+
/*
* Interface list and flags.
*/
@@ -76,6 +80,9 @@
uint64_t hc_opackets;
uint64_t hc_imcasts;
uint64_t hc_ipackets;
+
+ /* this should be made public */
+ char alias[MIBIF_ALIAS_SIZE];
};
#define MIBIF_PRIV(IFP) ((struct mibif_private *)((IFP)->private))
Modified: trunk/contrib/bsnmp/snmp_mibII/mibII_begemot.c
===================================================================
--- trunk/contrib/bsnmp/snmp_mibII/mibII_begemot.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_mibII/mibII_begemot.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -37,7 +37,7 @@
* Scalars
*/
int
-op_begemot_mibII(struct snmp_context *ctx __unused, struct snmp_value *value,
+op_begemot_mibII(struct snmp_context *ctx, struct snmp_value *value,
u_int sub, u_int idx __unused, enum snmp_op op)
{
switch (op) {
Modified: trunk/contrib/bsnmp/snmp_mibII/mibII_ifmib.c
===================================================================
--- trunk/contrib/bsnmp/snmp_mibII/mibII_ifmib.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_mibII/mibII_ifmib.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/snmp_mibII/mibII_ifstack.c
===================================================================
--- trunk/contrib/bsnmp/snmp_mibII/mibII_ifstack.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_mibII/mibII_ifstack.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/snmp_mibII/mibII_interfaces.c
===================================================================
--- trunk/contrib/bsnmp/snmp_mibII/mibII_interfaces.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_mibII/mibII_interfaces.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -77,7 +77,7 @@
switch (op) {
case SNMP_DEPOP_COMMIT:
- strncpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
+ strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
if (ioctl(mib_netsock, SIOCGIFFLAGS, &ifr) == -1) {
syslog(LOG_ERR, "GIFFLAGS(%s): %m", ifp->name);
return (SNMP_ERR_GENERR);
@@ -95,7 +95,7 @@
ifc->rb |= IFRB_FLAGS;
}
if (ifc->rb & IFRB_FLAGS) {
- strncpy(ifr1.ifr_name, ifp->name, sizeof(ifr1.ifr_name));
+ strlcpy(ifr1.ifr_name, ifp->name, sizeof(ifr1.ifr_name));
if (ioctl(mib_netsock, SIOCGIFFLAGS, &ifr1) == -1) {
syslog(LOG_ERR, "GIFFLAGS(%s): %m", ifp->name);
return (SNMP_ERR_GENERR);
@@ -116,7 +116,7 @@
case SNMP_DEPOP_ROLLBACK:
if (ifc->rb & IFRB_FLAGS) {
- strncpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
+ strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
ifr.ifr_flags = ifc->rb_flags;
if (ioctl(mib_netsock, SIOCSIFFLAGS, &ifr) == -1) {
syslog(LOG_ERR, "SIFFLAGS(%s): %m", ifp->name);
@@ -356,7 +356,7 @@
value->v.oid = ifp->spec_oid;
break;
}
- return (SNMP_ERR_NOERROR);
+ return (ret);
}
/*
@@ -528,7 +528,7 @@
break;
case LEAF_ifAlias:
- ret = string_get(value, "", -1);
+ ret = string_get(value, MIBIF_PRIV(ifp)->alias, -1);
break;
case LEAF_ifCounterDiscontinuityTime:
Modified: trunk/contrib/bsnmp/snmp_mibII/mibII_ip.c
===================================================================
--- trunk/contrib/bsnmp/snmp_mibII/mibII_ip.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_mibII/mibII_ip.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -151,7 +151,7 @@
op_ip(struct snmp_context *ctx, struct snmp_value *value,
u_int sub, u_int idx __unused, enum snmp_op op)
{
- int old;
+ int old = 0;
switch (op) {
Modified: trunk/contrib/bsnmp/snmp_mibII/mibII_ipaddr.c
===================================================================
--- trunk/contrib/bsnmp/snmp_mibII/mibII_ipaddr.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_mibII/mibII_ipaddr.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/snmp_mibII/mibII_nettomedia.c
===================================================================
--- trunk/contrib/bsnmp/snmp_mibII/mibII_nettomedia.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_mibII/mibII_nettomedia.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/snmp_mibII/mibII_rcvaddr.c
===================================================================
--- trunk/contrib/bsnmp/snmp_mibII/mibII_rcvaddr.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_mibII/mibII_rcvaddr.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/snmp_mibII/mibII_route.c
===================================================================
--- trunk/contrib/bsnmp/snmp_mibII/mibII_route.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_mibII/mibII_route.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -30,7 +30,6 @@
*
* Routing table
*/
-#include "support.h"
#ifdef HAVE_SYS_TREE_H
#include <sys/tree.h>
@@ -258,7 +257,7 @@
continue;
mib_extract_addrs(rtm->rtm_addrs, (u_char *)(rtm + 1), addrs);
-
+
mib_sroute_process(rtm, addrs[RTAX_GATEWAY], addrs[RTAX_DST],
addrs[RTAX_NETMASK]);
}
Modified: trunk/contrib/bsnmp/snmp_mibII/mibII_tcp.c
===================================================================
--- trunk/contrib/bsnmp/snmp_mibII/mibII_tcp.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_mibII/mibII_tcp.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/snmp_mibII/mibII_tree.def
===================================================================
--- trunk/contrib/bsnmp/snmp_mibII/mibII_tree.def 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_mibII/mibII_tree.def 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
# All rights reserved.
#
# Author: Harti Brandt <harti at freebsd.org>
-#
+#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@@ -13,7 +13,7 @@
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
-#
+#
# THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/snmp_mibII/mibII_udp.c
===================================================================
--- trunk/contrib/bsnmp/snmp_mibII/mibII_udp.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_mibII/mibII_udp.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/snmp_mibII/snmp_mibII.3
===================================================================
--- trunk/contrib/bsnmp/snmp_mibII/snmp_mibII.3 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_mibII/snmp_mibII.3 2018-06-19 14:44:12 UTC (rev 11089)
@@ -7,7 +7,7 @@
.\" All rights reserved.
.\"
.\" Author: Harti Brandt <harti at FreeBSD.org>
-.\"
+.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
@@ -16,7 +16,7 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\"
+.\"
.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -31,7 +31,7 @@
.\"
.\" $Begemot: bsnmp/snmp_mibII/snmp_mibII.3,v 1.10 2005/10/04 08:46:52 brandt_h Exp $
.\"
-.Dd October 4, 2005
+.Dd January 4, 2017
.Dt SNMP_MIBII 3
.Os
.Sh NAME
@@ -63,6 +63,8 @@
.Sh LIBRARY
.Pq begemotSnmpdModulePath."mibII" = "@MODPATH at snmp_mibII.so"
.Sh SYNOPSIS
+.In net/if.h
+.In net/if_mib.h
.In bsnmp/snmpmod.h
.In bsnmp/snmp_mibII.h
.Ft typedef void
Modified: trunk/contrib/bsnmp/snmp_mibII/snmp_mibII.h
===================================================================
--- trunk/contrib/bsnmp/snmp_mibII/snmp_mibII.h 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_mibII/snmp_mibII.h 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/snmp_ntp/NTP-MIB.txt
===================================================================
--- trunk/contrib/bsnmp/snmp_ntp/NTP-MIB.txt 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_ntp/NTP-MIB.txt 2018-06-19 14:44:12 UTC (rev 11089)
@@ -5,7 +5,7 @@
NTP-MIB DEFINITIONS ::= BEGIN
IMPORTS
- Integer32, IpAddress, MODULE-IDENTITY, OBJECT-TYPE, Unsigned32,
+ Integer32, IpAddress, MODULE-IDENTITY, OBJECT-TYPE, Unsigned32,
enterprises
FROM SNMPv2-SMI
@@ -14,9 +14,9 @@
ntpMIB MODULE-IDENTITY
LAST-UPDATED "199707251530Z"
- ORGANIZATION
+ ORGANIZATION
"University of Delaware"
- CONTACT-INFO
+ CONTACT-INFO
"Adarsh Sethi
Department of Computer & Information Sciences
University of Delaware
@@ -30,7 +30,7 @@
Newark, DE 19716
Tel: +1 302 831 ????
E-mail: mills at ee.udel.edu"
- DESCRIPTION
+ DESCRIPTION
"This MIB module defines a MIB which provides mechanisms to
monitor and control an NTP server."
::= { udel 3 }
@@ -60,18 +60,18 @@
NTPTimeStamp ::= TEXTUAL-CONVENTION
DISPLAY-HINT "4x.4x"
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
SYNTAX OCTET STRING (SIZE(8))
NTPLeapIndicator ::= TEXTUAL-CONVENTION
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
SYNTAX INTEGER {
noWarning(0),
addSecond(1),
- subtractSecond(2),
+ subtractSecond(2),
alarm(3) }
--
@@ -82,7 +82,7 @@
SYNTAX NTPLeapIndicator
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
" two-bit code warning of an impending leap
second to be inserted in the NTP timescale."
::= { ntpSystem 1 }
@@ -91,7 +91,7 @@
SYNTAX Integer32 (0..255)
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
" indicating the stratum of the local clock.
0, unspecified
1, primary reference (e.g.,, calibrated atomic clock,
@@ -103,7 +103,7 @@
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
"signed integer indicating the precision
of the various clocks, in seconds to the nearest power
of two."
@@ -113,7 +113,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
"the total roundtrip delay to the primary
reference source at the root of the synchronization
subnet, in seconds"
@@ -123,7 +123,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
"the maximum error relative to the primary
reference source at the root of the synchronization
subnet, in seconds. Only positive values greater
@@ -134,7 +134,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
" the particular reference clock. In the case of
stratum 0 (unspecified) or stratum 1 (primary reference
source), this is a four-octet, left-justified,zero-padded
@@ -147,7 +147,7 @@
SYNTAX NTPTimeStamp
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
" the local time when the local clock was last
updated. If the local clock has neverbeen synchronized,
the value is zero."
@@ -157,7 +157,7 @@
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
" the minimum interval between transmitted
messages, in seconds as a power of two. For instance,
a value of six indicates a minimum interval of 64 seconds."
@@ -167,7 +167,7 @@
SYNTAX Unsigned32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
" the current synchronization source. Usually
this will be a pointer to a structure containing the peer
variables. The special value NULL indicates there is no
@@ -178,7 +178,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpSystem 10 }
@@ -186,7 +186,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpSystem 11 }
@@ -194,7 +194,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpSystem 12 }
@@ -202,7 +202,7 @@
SYNTAX NTPTimeStamp
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
"the current local time. Local time is derived
from the hardware clock of the particular machine and
increments at intervals depending on the design used."
@@ -212,7 +212,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
" the type of the local Operating System"
::= { ntpSystem 14 }
@@ -220,7 +220,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
" the type of the local Processor"
::= { ntpSystem 15 }
@@ -236,7 +236,7 @@
SYNTAX SEQUENCE OF NtpPeersVarEntry
MAX-ACCESS not-accessible
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpPeers 1 }
@@ -244,7 +244,7 @@
SYNTAX NtpPeersVarEntry
MAX-ACCESS not-accessible
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
INDEX { ntpPeersAssocId }
::= { ntpPeersVarTable 1 }
@@ -281,7 +281,7 @@
SYNTAX Unsigned32
MAX-ACCESS not-accessible
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpPeersVarEntry 1 }
@@ -289,7 +289,7 @@
SYNTAX TruthValue
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
" This is a bit indicating that the association
was created from configuration information and should not
be demobilized if the peer becomes unreachable."
@@ -299,7 +299,7 @@
SYNTAX IpAddress
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
" the Internet address of the peer"
::= { ntpPeersVarEntry 3 }
@@ -307,7 +307,7 @@
SYNTAX Unsigned32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
" 16-bit port number of the peer."
::= { ntpPeersVarEntry 4 }
@@ -315,7 +315,7 @@
SYNTAX IpAddress
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
" the Internet address of the host"
::= { ntpPeersVarEntry 5 }
@@ -323,7 +323,7 @@
SYNTAX Unsigned32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
" 16-bit port number of the host"
::= { ntpPeersVarEntry 6 }
@@ -331,7 +331,7 @@
SYNTAX NTPLeapIndicator
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
" two-bit code warning of an impending leap
second to be inserted in the NTP timescale."
::= { ntpPeersVarEntry 7 }
@@ -339,10 +339,10 @@
ntpPeersMode OBJECT-TYPE
SYNTAX INTEGER {
unspecified(0),
- symmetricActive(1),
+ symmetricActive(1),
symmetricPassive(2),
client(3),
- server(4),
+ server(4),
broadcast(5),
reservedControl(6),
reservedPrivate(7)
@@ -349,7 +349,7 @@
}
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
" the association mode,with values coded as
follows:
0, unspecified
@@ -367,7 +367,7 @@
SYNTAX Integer32 (0..255)
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
" indicating the stratum of the peer clock.
0, unspecified
1, primary reference (e.g.,, calibrated atomic clock,
@@ -379,7 +379,7 @@
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
"poll interval of the peer"
::= { ntpPeersVarEntry 10 }
@@ -387,7 +387,7 @@
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
"poll interval of the host"
::= { ntpPeersVarEntry 11 }
@@ -395,7 +395,7 @@
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
"the same as the systemPrecision except this is
for the peer"
::= { ntpPeersVarEntry 12 }
@@ -404,7 +404,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
"the same as the systemRootDealy except this is for
the peer"
::= { ntpPeersVarEntry 13 }
@@ -413,7 +413,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
"the same as the systemDispersion except this is for
the peer"
::= { ntpPeersVarEntry 14 }
@@ -422,7 +422,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
"the same as the systemRefid except this is for
the peer"
::= { ntpPeersVarEntry 15 }
@@ -431,7 +431,7 @@
SYNTAX NTPTimeStamp
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
"the same as the systemRefTime except this is for
the peer"
::= { ntpPeersVarEntry 16 }
@@ -440,7 +440,7 @@
SYNTAX NTPTimeStamp
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
" the local time at the peer when its latest
NTP message was sent. If the peer becomes unreachable the
value is set to zero."
@@ -450,7 +450,7 @@
SYNTAX NTPTimeStamp
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
"the local time when the latest NTP message
from the peer arrived. If the peer becomes unreachable the
value is set to zero."
@@ -460,7 +460,7 @@
SYNTAX NTPTimeStamp
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
"the local time at which the NTP message
departed the sender."
::= { ntpPeersVarEntry 19 }
@@ -469,7 +469,7 @@
SYNTAX NTPTimeStamp
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
" "
::= { ntpPeersVarEntry 20 }
@@ -477,7 +477,7 @@
SYNTAX Unsigned32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
"a shift register of NTP.WINDOW bits used to determine
the reachability status of the peer, with bits entering
from the least significant (rightmost) end. A peer is
@@ -489,7 +489,7 @@
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpPeersVarEntry 22 }
@@ -497,7 +497,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpPeersVarEntry 23 }
@@ -505,7 +505,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpPeersVarEntry 24 }
@@ -513,7 +513,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpPeersVarEntry 25 }
@@ -532,7 +532,7 @@
SYNTAX SEQUENCE OF NtpFilterPeersVarEntry
MAX-ACCESS not-accessible
STATUS current
- DESCRIPTION
+ DESCRIPTION
"This table is an extension of the Peer Variables Table
in the Peer Group."
::= { ntpFilter 1 }
@@ -541,7 +541,7 @@
SYNTAX NtpFilterPeersVarEntry
MAX-ACCESS not-accessible
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
AUGMENTS { ntpPeersVarEntry }
::= { ntpFilterPeersVarTable 1 }
@@ -554,7 +554,7 @@
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
"The number of valid entries for a peer in the Filter Register Table."
::= { ntpFilterPeersVarEntry 1 }
@@ -566,7 +566,7 @@
SYNTAX SEQUENCE OF NtpFilterRegisterEntry
MAX-ACCESS not-accessible
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpFilter 2 }
@@ -574,7 +574,7 @@
SYNTAX NtpFilterRegisterEntry
MAX-ACCESS not-accessible
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
INDEX { ntpPeersAssocId, ntpFilterIndex }
::= { ntpFilterRegisterTable 1 }
@@ -590,7 +590,7 @@
SYNTAX Unsigned32
MAX-ACCESS not-accessible
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpFilterRegisterEntry 1 }
@@ -598,7 +598,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
"the offset of the peer clock relative to the
local clock in seconds"
::= { ntpFilterRegisterEntry 2 }
@@ -607,7 +607,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
"roundtrip delay of the peer clock relative to the
local clock over the network path between them, in seconds.
this variable can take on both positive and negative values,
@@ -618,7 +618,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
"the maximum error of the peer clock relative to the
local clock over the network path between them, in seconds.
Only positive values greater than zero are possible."
Modified: trunk/contrib/bsnmp/snmp_ntp/NTP-PROXY-MIB.txt
===================================================================
--- trunk/contrib/bsnmp/snmp_ntp/NTP-PROXY-MIB.txt 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_ntp/NTP-PROXY-MIB.txt 2018-06-19 14:44:12 UTC (rev 11089)
@@ -8,7 +8,7 @@
NTPLeapIndicator, NTPTimeStamp
FROM NTP-MIB
- Integer32, IpAddress, MODULE-IDENTITY, OBJECT-TYPE, Unsigned32,
+ Integer32, IpAddress, MODULE-IDENTITY, OBJECT-TYPE, Unsigned32,
enterprises
FROM SNMPv2-SMI
@@ -17,9 +17,9 @@
ntpProxyMIB MODULE-IDENTITY
LAST-UPDATED "199707251540Z"
- ORGANIZATION
+ ORGANIZATION
"University of Delaware"
- CONTACT-INFO
+ CONTACT-INFO
"Adarsh Sethi
Department of Computer & Information Sciences
University of Delaware
@@ -26,7 +26,7 @@
Newark, DE 19716
Tel: +1 302 831 1945
E-mail: sethi at cis.udel.edu
-
+
David Mills
Department of Electrical Engineering
University of Delaware
@@ -33,7 +33,7 @@
Newark, DE 19716
Tel: +1 302 831 ????
E-mail: mills at ee.udel.edu"
- DESCRIPTION
+ DESCRIPTION
"This MIB module defines a MIB which provides mechanisms to
monitor and control many NTP servers via a Proxy Agent."
::= { enterprises 1277 4 }
@@ -58,7 +58,7 @@
NTPRowStatus ::= TEXTUAL-CONVENTION
STATUS current
- DESCRIPTION
+ DESCRIPTION
"The NTPRowStatus textual convention is modeled after the
RowStatus textual convention of RFC 1903, but is simpler
because it only allows one create operation (the create-
@@ -81,7 +81,7 @@
create(3)
}
---
+--
-- Control group
--
@@ -93,7 +93,7 @@
SYNTAX SEQUENCE OF NtpProxyControlEntry
MAX-ACCESS not-accessible
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyControl 1 }
@@ -101,7 +101,7 @@
SYNTAX NtpProxyControlEntry
MAX-ACCESS not-accessible
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
INDEX { ntpProxyServerIPAddr }
::= { ntpProxyControlTable 1 }
@@ -115,7 +115,7 @@
SYNTAX IpAddress
MAX-ACCESS not-accessible
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyControlEntry 1 }
@@ -123,7 +123,7 @@
SYNTAX NTPRowStatus
MAX-ACCESS read-create
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyControlEntry 2 }
@@ -135,7 +135,7 @@
SYNTAX SEQUENCE OF NtpProxyServerSystemEntry
MAX-ACCESS not-accessible
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyControl 2 }
@@ -143,7 +143,7 @@
SYNTAX NtpProxyServerSystemEntry
MAX-ACCESS not-accessible
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
INDEX { ntpProxyServerIPAddr }
::= { ntpProxyServerSystemTable 1 }
@@ -170,7 +170,7 @@
SYNTAX NTPLeapIndicator
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyServerSystemEntry 1 }
@@ -178,7 +178,7 @@
SYNTAX Integer32 (0..255)
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyServerSystemEntry 2 }
@@ -186,7 +186,7 @@
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyServerSystemEntry 3 }
@@ -194,7 +194,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyServerSystemEntry 4 }
@@ -202,7 +202,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyServerSystemEntry 5 }
@@ -210,7 +210,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyServerSystemEntry 6 }
@@ -218,7 +218,7 @@
SYNTAX NTPTimeStamp
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyServerSystemEntry 7 }
@@ -226,7 +226,7 @@
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyServerSystemEntry 8 }
@@ -234,7 +234,7 @@
SYNTAX Unsigned32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyServerSystemEntry 9 }
@@ -242,7 +242,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyServerSystemEntry 10 }
@@ -250,7 +250,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyServerSystemEntry 11 }
@@ -258,7 +258,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyServerSystemEntry 12 }
@@ -266,7 +266,7 @@
SYNTAX NTPTimeStamp
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyServerSystemEntry 13 }
@@ -274,7 +274,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyServerSystemEntry 14 }
@@ -282,7 +282,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyServerSystemEntry 15 }
@@ -293,7 +293,7 @@
SYNTAX SEQUENCE OF NtpProxyPeersVarEntry
MAX-ACCESS not-accessible
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyControl 3 }
@@ -301,7 +301,7 @@
SYNTAX NtpProxyPeersVarEntry
MAX-ACCESS not-accessible
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
INDEX { ntpProxyServerIPAddr, ntpProxyPeersAssocId }
::= { ntpProxyPeersVarTable 1 }
@@ -339,7 +339,7 @@
SYNTAX Unsigned32
MAX-ACCESS not-accessible
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 1 }
@@ -347,7 +347,7 @@
SYNTAX TruthValue
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 2 }
@@ -355,7 +355,7 @@
SYNTAX IpAddress
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 3 }
@@ -363,7 +363,7 @@
SYNTAX Unsigned32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 4 }
@@ -371,7 +371,7 @@
SYNTAX IpAddress
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 5 }
@@ -379,7 +379,7 @@
SYNTAX Unsigned32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 6 }
@@ -387,7 +387,7 @@
SYNTAX NTPLeapIndicator
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 7 }
@@ -394,16 +394,16 @@
ntpProxyPeersMode OBJECT-TYPE
SYNTAX INTEGER {
unspecified(0),
- symmetricActive(1),
+ symmetricActive(1),
symmetricPassive(2),
client(3),
- server(4),
+ server(4),
broadcast(5),
reservedControl(6),
reservedPrivate(7) }
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 8 }
@@ -411,7 +411,7 @@
SYNTAX Integer32 (0..255)
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 9 }
@@ -419,7 +419,7 @@
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 10 }
@@ -427,7 +427,7 @@
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 11 }
@@ -435,7 +435,7 @@
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 12 }
@@ -443,7 +443,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 13 }
@@ -451,7 +451,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 14 }
@@ -459,7 +459,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 15 }
@@ -467,7 +467,7 @@
SYNTAX NTPTimeStamp
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 16 }
@@ -475,7 +475,7 @@
SYNTAX NTPTimeStamp
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 17 }
@@ -483,7 +483,7 @@
SYNTAX NTPTimeStamp
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 18 }
@@ -491,7 +491,7 @@
SYNTAX NTPTimeStamp
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 19 }
@@ -499,7 +499,7 @@
SYNTAX NTPTimeStamp
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 20 }
@@ -507,7 +507,7 @@
SYNTAX Unsigned32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 21 }
@@ -515,7 +515,7 @@
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 22 }
@@ -523,7 +523,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 23 }
@@ -531,7 +531,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 24 }
@@ -539,7 +539,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyPeersVarEntry 25 }
@@ -547,7 +547,7 @@
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
"The number of valid entries for a peer in the Proxy Filter
Register Table. This number can be zero."
::= { ntpProxyPeersVarEntry 26 }
@@ -560,7 +560,7 @@
SYNTAX SEQUENCE OF NtpProxyFilterRegisterEntry
MAX-ACCESS not-accessible
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyControl 4 }
@@ -568,9 +568,9 @@
SYNTAX NtpProxyFilterRegisterEntry
MAX-ACCESS not-accessible
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
- INDEX { ntpProxyServerIPAddr, ntpProxyPeersAssocId,
+ INDEX { ntpProxyServerIPAddr, ntpProxyPeersAssocId,
ntpProxyFilterIndex }
::= { ntpProxyFilterRegisterTable 1 }
@@ -585,7 +585,7 @@
SYNTAX Unsigned32
MAX-ACCESS not-accessible
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyFilterRegisterEntry 1 }
@@ -593,7 +593,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyFilterRegisterEntry 2 }
@@ -601,7 +601,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyFilterRegisterEntry 3 }
@@ -609,7 +609,7 @@
SYNTAX OCTET STRING
MAX-ACCESS read-only
STATUS current
- DESCRIPTION
+ DESCRIPTION
""
::= { ntpProxyFilterRegisterEntry 4 }
Modified: trunk/contrib/bsnmp/snmp_target/snmp_target.3
===================================================================
--- trunk/contrib/bsnmp/snmp_target/snmp_target.3 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_target/snmp_target.3 2018-06-19 14:44:12 UTC (rev 11089)
@@ -1,7 +1,7 @@
.\"-
.\" Copyright (C) 2010 The FreeBSD Foundation
.\" All rights reserved.
-.\"
+.\"
.\" This documentation was written by Shteryana Sotirova Shopova under
.\" sponsorship from the FreeBSD Foundation.
.\"
@@ -13,7 +13,7 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\"
+.\"
.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -26,7 +26,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/contrib/bsnmp/snmp_target/snmp_target.3 310903 2016-12-31 10:34:09Z ngie $
.\"
.Dd December 16, 2010
.Dt SNMP_TARGET 3
@@ -33,7 +33,7 @@
.Os
.Sh NAME
.Nm snmp_target
-.Nd "Target addresses and notifications module for
+.Nd "Target addresses and notifications module for"
.Xr bsnmpd 1
.Sh LIBRARY
.Pq begemotSnmpdModulePath."target" = "/usr/lib/snmp_target.so"
Modified: trunk/contrib/bsnmp/snmp_target/target_snmp.c
===================================================================
--- trunk/contrib/bsnmp/snmp_target/target_snmp.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_target/target_snmp.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/contrib/bsnmp/snmp_target/target_snmp.c 310671 2016-12-28 06:15:39Z ngie $
*/
#include <sys/queue.h>
#include <sys/types.h>
@@ -299,8 +299,9 @@
return (target_delete_address(addrs));
break;
default:
- break;
+ break;
}
+ return (SNMP_ERR_NOERROR);
default:
abort();
@@ -625,6 +626,7 @@
default:
break;
}
+ return (SNMP_ERR_NOERROR);
default:
abort();
@@ -663,13 +665,14 @@
static int
target_decode_index(const struct asn_oid *oid, uint sub, char *name)
{
- uint32_t i, len;
+ uint32_t i;
- if ((len = oid->len - sub) >= SNMP_ADM_STR32_SIZ)
+ if (oid->len - sub != oid->subs[sub] + 1 || oid->subs[sub] >=
+ SNMP_ADM_STR32_SIZ)
return (-1);
- for (i = 0; i < len; i++)
- name[i] = oid->subs[sub + i];
+ for (i = 0; i < oid->subs[sub]; i++)
+ name[i] = oid->subs[sub + i + 1];
name[i] = '\0';
return (0);
Modified: trunk/contrib/bsnmp/snmp_target/target_tree.def
===================================================================
--- trunk/contrib/bsnmp/snmp_target/target_tree.def 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_target/target_tree.def 2018-06-19 14:44:12 UTC (rev 11089)
@@ -26,7 +26,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $MidnightBSD$
+# $FreeBSD$
#
#include "tc.def"
Modified: trunk/contrib/bsnmp/snmp_usm/snmp_usm.3
===================================================================
--- trunk/contrib/bsnmp/snmp_usm/snmp_usm.3 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_usm/snmp_usm.3 2018-06-19 14:44:12 UTC (rev 11089)
@@ -1,7 +1,7 @@
.\"-
.\" Copyright (C) 2010 The FreeBSD Foundation
.\" All rights reserved.
-.\"
+.\"
.\" This documentation was written by Shteryana Sotirova Shopova under
.\" sponsorship from the FreeBSD Foundation.
.\"
@@ -13,7 +13,7 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\"
+.\"
.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -26,7 +26,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/contrib/bsnmp/snmp_usm/snmp_usm.3 310903 2016-12-31 10:34:09Z ngie $
.\"
.Dd September 9, 2010
.Dt SNMP_USM 3
@@ -33,7 +33,7 @@
.Os
.Sh NAME
.Nm snmp_usm
-.Nd "user-based security module for
+.Nd "user-based security module for"
.Xr bsnmpd 1
.Sh LIBRARY
.Pq begemotSnmpdModulePath."usm" = "/usr/lib/snmp_usm.so"
@@ -79,7 +79,7 @@
.It Va usmUserAuthProtocol
The value of this column contains the OID corresponding to the authentication
protocol used by the USM user. The following protocols and their OIDs are known to
-.Nm
+.Nm
module
.Bl -tag -width ".It Va NoAuthProtocol"
.It NoAuthProtocol 1.3.6.1.6.3.10.1.1.1
@@ -91,7 +91,7 @@
.It Va usmUserPrivProtocol
The value of this column contains the OID corresponding to the privacy
protocol used by the USM user. The following protocols and their OIDs are known to
-.Nm
+.Nm
module
.Bl -tag -width ".It Va NoPrivProtocol"
.It NoPrivProtocol 1.3.6.1.6.3.10.1.2.1
Modified: trunk/contrib/bsnmp/snmp_usm/usm_snmp.c
===================================================================
--- trunk/contrib/bsnmp/snmp_usm/usm_snmp.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_usm/usm_snmp.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/contrib/bsnmp/snmp_usm/usm_snmp.c 313222 2017-02-04 16:37:43Z ngie $
*/
#include <sys/queue.h>
#include <sys/types.h>
@@ -167,10 +167,14 @@
if ((uuser = usm_get_user(&val->var, sub)) == NULL &&
val->var.subs[sub - 1] != LEAF_usmUserStatus &&
val->var.subs[sub - 1] != LEAF_usmUserCloneFrom)
- return (SNMP_ERR_NOSUCHNAME);
+ return (SNMP_ERR_NOSUCHNAME);
+ /*
+ * XXX (ngie): need to investigate the MIB to determine how
+ * this is possible given some of the transitions below.
+ */
if (community != COMM_INITIALIZE &&
- uuser->type == StorageType_readOnly)
+ uuser != NULL && uuser->type == StorageType_readOnly)
return (SNMP_ERR_NOT_WRITEABLE);
switch (val->var.subs[sub - 1]) {
@@ -179,7 +183,7 @@
case LEAF_usmUserCloneFrom:
if (uuser != NULL || usm_user_index_decode(&val->var,
- sub, eid, &elen, uname) < 0 ||
+ sub, eid, &elen, uname) < 0 ||
!(asn_is_suboid(&oid_usmUserSecurityName, &val->v.oid)))
return (SNMP_ERR_WRONG_VALUE);
if ((clone = usm_get_user(&val->v.oid, sub)) == NULL)
@@ -262,7 +266,7 @@
if (ctx->scratch->ptr1 == NULL)
return (SNMP_ERR_GENERR);
memcpy(ctx->scratch->ptr1, uuser->suser.priv_key,
- SNMP_PRIV_KEY_SIZ);
+ sizeof(uuser->suser.priv_key));
memcpy(uuser->suser.priv_key, val->v.octetstring.octets,
val->v.octetstring.len);
break;
@@ -286,7 +290,7 @@
uuser->user_public_len = val->v.octetstring.len;
} else {
memset(uuser->user_public, 0,
- SNMP_ADM_STR32_SIZ);
+ sizeof(uuser->user_public));
uuser->user_public_len = 0;
}
break;
@@ -311,7 +315,7 @@
} else if (val->v.integer != RowStatus_active &&
val->v.integer != RowStatus_destroy)
return (SNMP_ERR_INCONS_VALUE);
-
+
uuser->status = val->v.integer;
break;
}
@@ -351,7 +355,7 @@
case LEAF_usmUserAuthKeyChange:
case LEAF_usmUserOwnAuthKeyChange:
memcpy(uuser->suser.auth_key, ctx->scratch->ptr1,
- SNMP_AUTH_KEY_SIZ);
+ sizeof(uuser->suser.auth_key));
free(ctx->scratch->ptr1);
break;
case LEAF_usmUserPrivProtocol:
@@ -360,7 +364,7 @@
case LEAF_usmUserPrivKeyChange:
case LEAF_usmUserOwnPrivKeyChange:
memcpy(uuser->suser.priv_key, ctx->scratch->ptr1,
- SNMP_AUTH_KEY_SIZ);
+ sizeof(uuser->suser.priv_key));
free(ctx->scratch->ptr1);
break;
case LEAF_usmUserPublic:
@@ -371,7 +375,7 @@
free(ctx->scratch->ptr2);
} else {
memset(uuser->user_public, 0,
- SNMP_ADM_STR32_SIZ);
+ sizeof(uuser->user_public));
uuser->user_public_len = 0;
}
break;
@@ -381,7 +385,7 @@
usm_delete_user(uuser);
break;
default:
- break;
+ break;
}
return (SNMP_ERR_NOERROR);
Modified: trunk/contrib/bsnmp/snmp_usm/usm_tree.def
===================================================================
--- trunk/contrib/bsnmp/snmp_usm/usm_tree.def 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_usm/usm_tree.def 2018-06-19 14:44:12 UTC (rev 11089)
@@ -26,7 +26,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $MidnightBSD$
+# $FreeBSD$
#
#include "tc.def"
Modified: trunk/contrib/bsnmp/snmp_vacm/snmp_vacm.3
===================================================================
--- trunk/contrib/bsnmp/snmp_vacm/snmp_vacm.3 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_vacm/snmp_vacm.3 2018-06-19 14:44:12 UTC (rev 11089)
@@ -1,7 +1,7 @@
.\"-
.\" Copyright (C) 2010 The FreeBSD Foundation
.\" All rights reserved.
-.\"
+.\"
.\" This documentation was written by Shteryana Sotirova Shopova under
.\" sponsorship from the FreeBSD Foundation.
.\"
@@ -13,7 +13,7 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\"
+.\"
.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -26,7 +26,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/contrib/bsnmp/snmp_vacm/snmp_vacm.3 310903 2016-12-31 10:34:09Z ngie $
.\"
.Dd October 7, 2010
.Dt SNMP_VACM 3
@@ -33,7 +33,7 @@
.Os
.Sh NAME
.Nm snmp_vacm
-.Nd "View-based Access Control module for
+.Nd "View-based Access Control module for"
.Xr bsnmpd 1
.Sh LIBRARY
.Pq begemotSnmpdModulePath."vacm" = "/usr/lib/snmp_vacm.so"
Modified: trunk/contrib/bsnmp/snmp_vacm/vacm_snmp.c
===================================================================
--- trunk/contrib/bsnmp/snmp_vacm/vacm_snmp.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_vacm/vacm_snmp.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/contrib/bsnmp/snmp_vacm/vacm_snmp.c 310903 2016-12-31 10:34:09Z ngie $
*/
#include <sys/queue.h>
#include <sys/types.h>
@@ -578,7 +578,7 @@
return (vacm_delete_view(view));
break;
default:
- break;
+ break;
}
return (SNMP_ERR_NOERROR);
@@ -683,7 +683,7 @@
const struct vacm_access *acl)
{
uint32_t i;
-
+
oid->len = sub + strlen(acl->group->groupname) +
strlen(acl->ctx_prefix) + 4;
@@ -776,7 +776,7 @@
static int
vacm_view_index_decode(const struct asn_oid *oid, uint sub, char *vname,
struct asn_oid *view_oid)
-{
+{
uint32_t i;
int viod_off;
Modified: trunk/contrib/bsnmp/snmp_vacm/vacm_tree.def
===================================================================
--- trunk/contrib/bsnmp/snmp_vacm/vacm_tree.def 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmp_vacm/vacm_tree.def 2018-06-19 14:44:12 UTC (rev 11089)
@@ -26,7 +26,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $MidnightBSD$
+# $FreeBSD$
#
#include "tc.def"
Modified: trunk/contrib/bsnmp/snmpd/BEGEMOT-MIB.txt
===================================================================
--- trunk/contrib/bsnmp/snmpd/BEGEMOT-MIB.txt 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmpd/BEGEMOT-MIB.txt 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
-- All rights reserved.
--
-- Author: Harti Brandt <harti at freebsd.org>
---
+--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions
-- are met:
@@ -13,7 +13,7 @@
-- 2. Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
---
+--
-- THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -54,6 +54,9 @@
E-mail: harti at freebsd.org"
DESCRIPTION
"The root of the Begemot subtree of the fokus tree."
+ REVISION "200201300000Z"
+ DESCRIPTION
+ "Initial revision."
::= { fokus 1 }
END
Modified: trunk/contrib/bsnmp/snmpd/BEGEMOT-SNMPD.txt
===================================================================
--- trunk/contrib/bsnmp/snmpd/BEGEMOT-SNMPD.txt 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmpd/BEGEMOT-SNMPD.txt 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
-- All rights reserved.
--
-- Author: Harti Brandt <harti at freebsd.org>
---
+--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions
-- are met:
@@ -13,7 +13,7 @@
-- 2. Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
---
+--
-- THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/snmpd/FOKUS-MIB.txt
===================================================================
--- trunk/contrib/bsnmp/snmpd/FOKUS-MIB.txt 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmpd/FOKUS-MIB.txt 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
-- All rights reserved.
--
-- Author: Harti Brandt <harti at freebsd.org>
---
+--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions
-- are met:
@@ -13,7 +13,7 @@
-- 2. Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
---
+--
-- THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -52,6 +52,9 @@
E-mail: harti at freebsd.org"
DESCRIPTION
"The root of the Fokus enterprises tree."
+ REVISION "200202050000Z"
+ DESCRIPTION
+ "Initial revision."
::= { enterprises 12325 }
END
Modified: trunk/contrib/bsnmp/snmpd/action.c
===================================================================
--- trunk/contrib/bsnmp/snmpd/action.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmpd/action.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -7,7 +7,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -16,7 +16,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -38,12 +38,13 @@
#include <sys/sysctl.h>
#include <sys/un.h>
#include <sys/utsname.h>
+#include <ctype.h>
+#include <errno.h>
+#include <inttypes.h>
+#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
-#include <stdarg.h>
#include <string.h>
-#include <ctype.h>
-#include <errno.h>
#include <syslog.h>
#include "snmpmod.h"
@@ -60,29 +61,6 @@
#endif
/*
- * Get a string value from the KERN sysctl subtree.
- */
-static char *
-act_getkernstring(int id)
-{
- int mib[2];
- size_t len;
- char *string;
-
- mib[0] = CTL_KERN;
- mib[1] = id;
- if (sysctl(mib, 2, NULL, &len, NULL, 0) != 0)
- return (NULL);
- if ((string = malloc(len)) == NULL)
- return (NULL);
- if (sysctl(mib, 2, string, &len, NULL, 0) != 0) {
- free(string);
- return (NULL);
- }
- return (string);
-}
-
-/*
* Get an integer value from the KERN sysctl subtree.
*/
static char *
@@ -193,7 +171,7 @@
} else {
memcpy(snmpd_engine.engine_id + snmpd_engine.engine_len,
hostid, strlen(hostid));
- snmpd_engine.engine_len += strlen(hostid);
+ snmpd_engine.engine_len += strlen(hostid);
}
free(hostid);
@@ -242,6 +220,21 @@
return (0);
}
+void
+update_snmpd_engine_time(void)
+{
+ uint64_t etime;
+
+ etime = (get_ticks() - start_tick) / 100ULL;
+ if (etime < INT32_MAX)
+ snmpd_engine.engine_time = etime;
+ else {
+ start_tick = get_ticks();
+ (void)set_snmpd_engine();
+ snmpd_engine.engine_time = start_tick;
+ }
+}
+
/*************************************************************
*
* System group
@@ -1096,7 +1089,7 @@
ctx->scratch->int1 = snmpd_engine.max_msg_size;
snmpd_engine.max_msg_size = value->v.integer;
break;
-
+
default:
return (SNMP_ERR_NOT_WRITEABLE);
}
@@ -1126,7 +1119,7 @@
snmpd_engine.engine_len = ctx->scratch->int1;
memcpy(snmpd_engine.engine_id,
ctx->scratch->ptr1, ctx->scratch->int1);
- }
+ }
free(ctx->scratch->ptr1);
}
return (SNMP_ERR_NOERROR);
@@ -1141,7 +1134,7 @@
value->v.integer = snmpd_engine.engine_boots;
break;
case LEAF_snmpEngineTime:
- snmpd_engine.engine_time = (get_ticks() - start_tick) / 100ULL;
+ update_snmpd_engine_time();
value->v.integer = snmpd_engine.engine_time;
break;
case LEAF_snmpEngineMaxMessageSize:
Modified: trunk/contrib/bsnmp/snmpd/bsnmpd.1
===================================================================
--- trunk/contrib/bsnmp/snmpd/bsnmpd.1 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmpd/bsnmpd.1 2018-06-19 14:44:12 UTC (rev 11089)
@@ -7,7 +7,7 @@
.\" All rights reserved.
.\"
.\" Author: Harti Brandt <harti at FreeBSD.org>
-.\"
+.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
@@ -16,7 +16,7 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\"
+.\"
.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -31,7 +31,7 @@
.\"
.\" $Begemot: bsnmp/snmpd/bsnmpd.1,v 1.12 2006/02/27 09:50:03 brandt_h Exp $
.\"
-.Dd September 9, 2010
+.Dd May 14, 2016
.Dt BSNMPD 1
.Os
.Sh NAME
@@ -227,7 +227,7 @@
.Pp
results in the oid
.Bd -unfilled -offset indent
-myvariable.27.6.102.111.111.111.108.108.127.0.0.1.38.94.33
+myvariable.27.102.111.111.111.108.108.127.0.0.1.38.94.33
.Ed
.Pp
The value of the assignment may be either empty, a string or a number.
Modified: trunk/contrib/bsnmp/snmpd/config.c
===================================================================
--- trunk/contrib/bsnmp/snmpd/config.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmpd/config.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -823,7 +823,8 @@
while (token == '.') {
if (gettoken() == TOK_NUM) {
if (numval > ASN_MAXID)
- report("subid too large %#"QUADXFMT, numval);
+ report("subid too large %#jx",
+ (uintmax_t)numval);
if (oid->len == ASN_MAXOIDLEN)
report("index too long");
if (gettoken() != ':')
@@ -878,7 +879,7 @@
if (token != TOK_NUM)
report("bad INTEGER syntax");
if (numval > 0x7fffffff)
- report("INTEGER too large %"QUADFMT, numval);
+ report("INTEGER too large %ju", (uintmax_t)numval);
value->v.integer = numval;
gettoken();
@@ -1150,7 +1151,8 @@
free(m->value);
m->value = string;
m->length = length;
- }
+ } else
+ free(string);
}
token = TOK_EOL;
Modified: trunk/contrib/bsnmp/snmpd/export.c
===================================================================
--- trunk/contrib/bsnmp/snmpd/export.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmpd/export.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -114,9 +114,11 @@
}
if (len == -1)
len = strlen(ptr);
+ if ((value->v.octetstring.octets = malloc((size_t)len)) == NULL) {
+ value->v.octetstring.len = 0;
+ return (SNMP_ERR_RES_UNAVAIL);
+ }
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);
}
@@ -138,9 +140,11 @@
len = strlen(ptr);
if ((size_t)len > maxlen)
len = maxlen;
+ if ((value->v.octetstring.octets = malloc((size_t)len)) == NULL) {
+ value->v.octetstring.len = 0;
+ return (SNMP_ERR_RES_UNAVAIL);
+ }
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);
}
@@ -194,6 +198,7 @@
value->v.ipaddress[1] = valp[1];
value->v.ipaddress[2] = valp[2];
value->v.ipaddress[3] = valp[3];
+
return (SNMP_ERR_NOERROR);
}
Modified: trunk/contrib/bsnmp/snmpd/main.c
===================================================================
--- trunk/contrib/bsnmp/snmpd/main.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmpd/main.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Copyright (c) 2010 The FreeBSD Foundation
* All rights reserved.
*
@@ -19,7 +19,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -53,7 +53,6 @@
#include <unistd.h>
#include <signal.h>
#include <dlfcn.h>
-#include <inttypes.h>
#ifdef USE_TCPWRAPPERS
#include <arpa/inet.h>
@@ -119,13 +118,15 @@
struct community_list community_list = TAILQ_HEAD_INITIALIZER(community_list);
/* list of all known USM users */
-struct usm_userlist usm_userlist = SLIST_HEAD_INITIALIZER(usm_userlist);
+static struct usm_userlist usm_userlist = SLIST_HEAD_INITIALIZER(usm_userlist);
/* A list of all VACM users configured, including v1, v2c and v3 */
-struct vacm_userlist vacm_userlist = SLIST_HEAD_INITIALIZER(vacm_userlist);
+static struct vacm_userlist vacm_userlist =
+ SLIST_HEAD_INITIALIZER(vacm_userlist);
/* A list of all VACM groups */
-struct vacm_grouplist vacm_grouplist = SLIST_HEAD_INITIALIZER(vacm_grouplist);
+static struct vacm_grouplist vacm_grouplist =
+ SLIST_HEAD_INITIALIZER(vacm_grouplist);
static struct vacm_group vacm_default_group = {
.groupname = "",
@@ -132,13 +133,15 @@
};
/* The list of configured access entries */
-struct vacm_accesslist vacm_accesslist = TAILQ_HEAD_INITIALIZER(vacm_accesslist);
+static struct vacm_accesslist vacm_accesslist =
+ TAILQ_HEAD_INITIALIZER(vacm_accesslist);
/* The list of configured views */
-struct vacm_viewlist vacm_viewlist = SLIST_HEAD_INITIALIZER(vacm_viewlist);
+static struct vacm_viewlist vacm_viewlist =
+ SLIST_HEAD_INITIALIZER(vacm_viewlist);
/* The list of configured contexts */
-struct vacm_contextlist vacm_contextlist =
+static struct vacm_contextlist vacm_contextlist =
SLIST_HEAD_INITIALIZER(vacm_contextlist);
/* list of all installed object resources */
@@ -278,12 +281,13 @@
const char *dest)
{
struct asn_buf resp_b;
+ enum snmp_code code;
resp_b.asn_ptr = sndbuf;
resp_b.asn_len = snmpd.txbuf;
- if (snmp_pdu_encode(pdu, &resp_b) != 0) {
- syslog(LOG_ERR, "cannot encode message");
+ if ((code = snmp_pdu_encode(pdu, &resp_b)) != SNMP_CODE_OK) {
+ syslog(LOG_ERR, "cannot encode message (code=%d)", code);
abort();
}
if (debug.dump_pdus) {
@@ -299,7 +303,6 @@
static enum snmp_code
snmp_pdu_auth_user(struct snmp_pdu *pdu)
{
- uint64_t etime;
usm_user = NULL;
/* un-authenticated snmpEngineId discovery */
@@ -307,6 +310,7 @@
pdu->engine.engine_len = snmpd_engine.engine_len;
memcpy(pdu->engine.engine_id, snmpd_engine.engine_id,
snmpd_engine.engine_len);
+ update_snmpd_engine_time();
pdu->engine.engine_boots = snmpd_engine.engine_boots;
pdu->engine.engine_time = snmpd_engine.engine_time;
pdu->flags |= SNMP_MSG_AUTODISCOVER;
@@ -329,15 +333,7 @@
/* authenticated snmpEngineId discovery */
if ((pdu->flags & SNMP_MSG_AUTH_FLAG) != 0) {
- etime = (get_ticks() - start_tick) / 100ULL;
- if (etime < INT32_MAX)
- snmpd_engine.engine_time = etime;
- else {
- start_tick = get_ticks();
- set_snmpd_engine();
- snmpd_engine.engine_time = start_tick;
- }
-
+ update_snmpd_engine_time();
pdu->user.auth_proto = usm_user->suser.auth_proto;
memcpy(pdu->user.auth_key, usm_user->suser.auth_key,
sizeof(pdu->user.auth_key));
@@ -344,6 +340,7 @@
if (pdu->engine.engine_boots == 0 &&
pdu->engine.engine_time == 0) {
+ update_snmpd_engine_time();
pdu->flags |= SNMP_MSG_AUTODISCOVER;
return (SNMP_CODE_OK);
}
@@ -495,6 +492,8 @@
b.asn_cptr = buf;
b.asn_len = len;
+ ret = SNMPD_INPUT_OK;
+
/* look whether we have enough bytes for the entire PDU. */
switch (sret = snmp_pdu_snoop(&b)) {
@@ -523,8 +522,6 @@
}
code = snmp_pdu_decode_scoped(&b, pdu, ip);
- ret = SNMPD_INPUT_OK;
-
decoded:
snmpd_stats.inPkts++;
@@ -638,6 +635,7 @@
pdu->engine.engine_time == 0) {
asn_append_oid(&(pdu->bindings[pdu->nbindings++].var),
&oid_usmNotInTimeWindows);
+ update_snmpd_engine_time();
pdu->engine.engine_boots = snmpd_engine.engine_boots;
pdu->engine.engine_time = snmpd_engine.engine_time;
}
@@ -644,11 +642,11 @@
} else if (usm_user->suser.auth_proto != SNMP_AUTH_NOAUTH &&
(pdu->engine.engine_boots == 0 || pdu->engine.engine_time == 0)) {
snmpd_usmstats.not_in_time_windows++;
- ret = SNMP_CODE_FAILED;
+ ret = SNMPD_INPUT_FAILED;
}
if ((code = snmp_pdu_auth_access(pdu, ip)) != SNMP_CODE_OK)
- ret = SNMP_CODE_FAILED;
+ ret = SNMPD_INPUT_FAILED;
return (ret);
}
@@ -767,6 +765,7 @@
{
struct tport *p;
+ port->transport = t;
TAILQ_FOREACH(p, &t->table, link) {
if (asn_compare_oid(&p->index, &port->index) > 0) {
TAILQ_INSERT_BEFORE(p, port, link);
@@ -773,7 +772,6 @@
return;
}
}
- port->transport = t;
TAILQ_INSERT_TAIL(&t->table, port, link);
}
@@ -1026,155 +1024,7 @@
pi->length -= pi->consumed;
}
-static void
-check_priv_dgram(struct port_input *pi, struct sockcred *cred)
-{
-
- /* process explicitly sends credentials */
- if (cred)
- pi->priv = (cred->sc_euid == 0);
- else
- pi->priv = 0;
-}
-
-static void
-check_priv_stream(struct port_input *pi)
-{
- struct xucred ucred;
- socklen_t ucredlen;
-
- /* obtain the accept time credentials */
- ucredlen = sizeof(ucred);
-
- if (getsockopt(pi->fd, 0, LOCAL_PEERCRED, &ucred, &ucredlen) == 0 &&
- ucredlen >= sizeof(ucred) && ucred.cr_version == XUCRED_VERSION)
- pi->priv = (ucred.cr_uid == 0);
- else
- pi->priv = 0;
-}
-
/*
- * Input from a stream socket.
- */
-static int
-recv_stream(struct port_input *pi)
-{
- struct msghdr msg;
- struct iovec iov[1];
- ssize_t len;
-
- if (pi->buf == NULL) {
- /* no buffer yet - allocate one */
- if ((pi->buf = buf_alloc(0)) == NULL) {
- /* ups - could not get buffer. Return an error
- * the caller must close the transport. */
- return (-1);
- }
- pi->buflen = buf_size(0);
- pi->consumed = 0;
- pi->length = 0;
- }
-
- /* try to get a message */
- msg.msg_name = pi->peer;
- msg.msg_namelen = pi->peerlen;
- msg.msg_iov = iov;
- msg.msg_iovlen = 1;
- msg.msg_control = NULL;
- msg.msg_controllen = 0;
- msg.msg_flags = 0;
-
- iov[0].iov_base = pi->buf + pi->length;
- iov[0].iov_len = pi->buflen - pi->length;
-
- len = recvmsg(pi->fd, &msg, 0);
-
- if (len == -1 || len == 0)
- /* receive error */
- return (-1);
-
- pi->length += len;
-
- if (pi->cred)
- check_priv_stream(pi);
-
- return (0);
-}
-
-/*
- * Input from a datagram socket.
- * Each receive should return one datagram.
- */
-static int
-recv_dgram(struct port_input *pi, struct in_addr *laddr)
-{
- u_char embuf[1000];
- char cbuf[CMSG_SPACE(SOCKCREDSIZE(CMGROUP_MAX)) +
- CMSG_SPACE(sizeof(struct in_addr))];
- struct msghdr msg;
- struct iovec iov[1];
- ssize_t len;
- struct cmsghdr *cmsg;
- struct sockcred *cred = NULL;
-
- if (pi->buf == NULL) {
- /* no buffer yet - allocate one */
- if ((pi->buf = buf_alloc(0)) == NULL) {
- /* ups - could not get buffer. Read away input
- * and drop it */
- (void)recvfrom(pi->fd, embuf, sizeof(embuf),
- 0, NULL, NULL);
- /* return error */
- return (-1);
- }
- pi->buflen = buf_size(0);
- }
-
- /* try to get a message */
- msg.msg_name = pi->peer;
- msg.msg_namelen = pi->peerlen;
- msg.msg_iov = iov;
- msg.msg_iovlen = 1;
- memset(cbuf, 0, sizeof(cbuf));
- msg.msg_control = cbuf;
- msg.msg_controllen = sizeof(cbuf);
- msg.msg_flags = 0;
-
- iov[0].iov_base = pi->buf;
- iov[0].iov_len = pi->buflen;
-
- len = recvmsg(pi->fd, &msg, 0);
-
- if (len == -1 || len == 0)
- /* receive error */
- return (-1);
-
- if (msg.msg_flags & MSG_TRUNC) {
- /* truncated - drop */
- snmpd_stats.silentDrops++;
- snmpd_stats.inTooLong++;
- return (-1);
- }
-
- pi->length = (size_t)len;
-
- for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL;
- cmsg = CMSG_NXTHDR(&msg, cmsg)) {
- if (cmsg->cmsg_level == IPPROTO_IP &&
- cmsg->cmsg_type == IP_RECVDSTADDR)
- memcpy(laddr, CMSG_DATA(cmsg), sizeof(struct in_addr));
- if (cmsg->cmsg_level == SOL_SOCKET &&
- cmsg->cmsg_type == SCM_CREDS)
- cred = (struct sockcred *)CMSG_DATA(cmsg);
- }
-
- if (pi->cred)
- check_priv_dgram(pi, cred);
-
- return (0);
-}
-
-/*
* Input from a socket
*/
int
@@ -1185,43 +1035,13 @@
struct snmp_pdu pdu;
enum snmpd_input_err ierr, ferr;
enum snmpd_proxy_err perr;
+ ssize_t ret, slen;
int32_t vi;
- int ret;
- ssize_t slen;
#ifdef USE_TCPWRAPPERS
char client[16];
#endif
- struct msghdr msg;
- struct iovec iov[1];
- char cbuf[CMSG_SPACE(sizeof(struct in_addr))];
- struct cmsghdr *cmsgp;
- /* get input depending on the transport */
- if (pi->stream) {
- msg.msg_control = NULL;
- msg.msg_controllen = 0;
-
- ret = recv_stream(pi);
- } else {
- struct in_addr *laddr;
-
- memset(cbuf, 0, CMSG_SPACE(sizeof(struct in_addr)));
- msg.msg_control = cbuf;
- msg.msg_controllen = CMSG_SPACE(sizeof(struct in_addr));
- cmsgp = CMSG_FIRSTHDR(&msg);
- cmsgp->cmsg_len = CMSG_LEN(sizeof(struct in_addr));
- cmsgp->cmsg_level = IPPROTO_IP;
- cmsgp->cmsg_type = IP_SENDSRCADDR;
- laddr = (struct in_addr *)CMSG_DATA(cmsgp);
-
- ret = recv_dgram(pi, laddr);
-
- if (laddr->s_addr == 0) {
- msg.msg_control = NULL;
- msg.msg_controllen = 0;
- }
- }
-
+ ret = tport->transport->vtab->recv(tport, pi);
if (ret == -1)
return (-1);
@@ -1364,21 +1184,15 @@
sndbuf, &sndlen, "SNMP", ierr, vi, NULL);
if (ferr == SNMPD_INPUT_OK) {
- msg.msg_name = pi->peer;
- msg.msg_namelen = pi->peerlen;
- msg.msg_iov = iov;
- msg.msg_iovlen = 1;
- msg.msg_flags = 0;
- iov[0].iov_base = sndbuf;
- iov[0].iov_len = sndlen;
-
- slen = sendmsg(pi->fd, &msg, 0);
+ slen = tport->transport->vtab->send(tport, sndbuf, sndlen,
+ pi->peer, pi->peerlen);
if (slen == -1)
- syslog(LOG_ERR, "sendmsg: %m");
+ syslog(LOG_ERR, "send*: %m");
else if ((size_t)slen != sndlen)
- syslog(LOG_ERR, "sendmsg: short write %zu/%zu",
- sndlen, (size_t)slen);
+ syslog(LOG_ERR, "send*: short write %zu/%zu", sndlen,
+ (size_t)slen);
}
+
snmp_pdu_free(&pdu);
free(sndbuf);
snmp_input_consume(pi);
@@ -2510,13 +2324,12 @@
}
m->handle = NULL;
m->flags = 0;
- strcpy(m->section, section);
+ strlcpy(m->section, section, sizeof(m->section));
- if ((m->path = malloc(strlen(path) + 1)) == NULL) {
+ if ((m->path = strdup(path)) == NULL) {
syslog(LOG_ERR, "lm_load: %m");
goto err;
}
- strcpy(m->path, path);
/*
* Make index
@@ -2726,7 +2539,7 @@
void
bsnmpd_reset_usm_stats(void)
{
- memset(&snmpd_usmstats, 0, sizeof(&snmpd_usmstats));
+ memset(&snmpd_usmstats, 0, sizeof(snmpd_usmstats));
}
struct usm_user *
@@ -2809,7 +2622,7 @@
if ((uuser = (struct usm_user *)malloc(sizeof(*uuser))) == NULL)
return (NULL);
- memset(uuser, 0, sizeof(struct usm_user));
+ memset(uuser, 0, sizeof(*uuser));
strlcpy(uuser->suser.sec_name, uname, SNMP_ADM_STR32_SIZ);
memcpy(uuser->user_engine_id, eid, elen);
uuser->user_engine_len = elen;
Modified: trunk/contrib/bsnmp/snmpd/snmpd.config
===================================================================
--- trunk/contrib/bsnmp/snmpd/snmpd.config 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmpd/snmpd.config 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
# All rights reserved.
#
# Author: Harti Brandt <harti at freebsd.org>
-#
+#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@@ -13,7 +13,7 @@
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
-#
+#
# THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/snmpd/snmpd.h
===================================================================
--- trunk/contrib/bsnmp/snmpd/snmpd.h 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmpd/snmpd.h 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -193,6 +193,7 @@
ssize_t (*send)(struct tport *, const u_char *, size_t,
const struct sockaddr *, size_t);
+ ssize_t (*recv)(struct tport *, struct port_input *);
};
struct transport {
struct asn_oid index; /* transport table index */
@@ -307,7 +308,7 @@
struct asn_oid index;
u_int status;
int socket;
- u_char comm[SNMP_COMMUNITY_MAXLEN];
+ u_char comm[SNMP_COMMUNITY_MAXLEN + 1];
int version;
};
enum {
@@ -332,6 +333,7 @@
extern char engine_file[];
int init_snmpd_engine(void);
int set_snmpd_engine(void);
+void update_snmpd_engine_time(void);
int read_config(const char *, struct lmodule *);
int define_macro(const char *name, const char *value);
Modified: trunk/contrib/bsnmp/snmpd/snmpd.sh
===================================================================
--- trunk/contrib/bsnmp/snmpd/snmpd.sh 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmpd/snmpd.sh 2018-06-19 14:44:12 UTC (rev 11089)
@@ -5,7 +5,7 @@
# All rights reserved.
#
# Author: Harti Brandt <harti at freebsd.org>
-#
+#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@@ -14,7 +14,7 @@
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
-#
+#
# THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/snmpd/snmpmod.3
===================================================================
--- trunk/contrib/bsnmp/snmpd/snmpmod.3 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmpd/snmpmod.3 2018-06-19 14:44:12 UTC (rev 11089)
@@ -7,7 +7,7 @@
.\" All rights reserved.
.\"
.\" Author: Harti Brandt <harti at FreeBSD.org>
-.\"
+.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
@@ -16,7 +16,7 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\"
+.\"
.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/snmpd/snmpmod.h
===================================================================
--- trunk/contrib/bsnmp/snmpd/snmpmod.h 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmpd/snmpmod.h 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Copyright (c) 2010 The FreeBSD Foundation
* All rights reserved.
*
@@ -19,7 +19,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -317,8 +317,8 @@
u_char *contact;
u_char *name;
u_char *location;
- u_int32_t services;
- u_int32_t or_last_change;
+ uint32_t services;
+ uint32_t or_last_change;
};
extern struct systemg systemg;
Modified: trunk/contrib/bsnmp/snmpd/trans_lsock.c
===================================================================
--- trunk/contrib/bsnmp/snmpd/trans_lsock.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmpd/trans_lsock.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -32,15 +32,16 @@
*/
#include <sys/types.h>
#include <sys/queue.h>
+#include <sys/stat.h>
+#include <sys/ucred.h>
#include <sys/un.h>
-#include <sys/stat.h>
+#include <errno.h>
+#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
-#include <stddef.h>
+#include <string.h>
#include <syslog.h>
-#include <string.h>
-#include <errno.h>
#include <unistd.h>
#include "snmpmod.h"
@@ -58,6 +59,7 @@
static int lsock_init_port(struct tport *);
static ssize_t lsock_send(struct tport *, const u_char *, size_t,
const struct sockaddr *, size_t);
+static ssize_t lsock_recv(struct tport *, struct port_input *);
/* exported */
const struct transport_def lsock_trans = {
@@ -67,7 +69,8 @@
lsock_stop,
lsock_close_port,
lsock_init_port,
- lsock_send
+ lsock_send,
+ lsock_recv
};
static struct transport *my_trans;
@@ -143,16 +146,14 @@
return (SNMP_ERR_BADVALUE);
}
- if ((port = malloc(sizeof(*port))) == NULL)
+ if ((port = calloc(1, sizeof(*port))) == NULL)
return (SNMP_ERR_GENERR);
- memset(port, 0, sizeof(*port));
if (!is_stream) {
- if ((peer = malloc(sizeof(*peer))) == NULL) {
+ if ((peer = calloc(1, sizeof(*peer))) == NULL) {
free(port);
return (SNMP_ERR_GENERR);
}
- memset(peer, 0, sizeof(*peer));
}
if ((port->name = malloc(namelen + 1)) == NULL) {
free(port);
@@ -258,12 +259,11 @@
struct lsock_port *p = udata;
struct lsock_peer *peer;
- if ((peer = malloc(sizeof(*peer))) == NULL) {
+ if ((peer = calloc(1, sizeof(*peer))) == NULL) {
syslog(LOG_WARNING, "%s: peer malloc failed", p->name);
(void)close(accept(fd, NULL, NULL));
return;
}
- memset(peer, 0, sizeof(*peer));
peer->port = p;
@@ -305,10 +305,9 @@
return (SNMP_ERR_RES_UNAVAIL);
}
- strcpy(sa.sun_path, p->name);
+ strlcpy(sa.sun_path, p->name, sizeof(sa.sun_path));
sa.sun_family = AF_LOCAL;
- sa.sun_len = strlen(p->name) +
- offsetof(struct sockaddr_un, sun_path);
+ sa.sun_len = SUN_LEN(&sa);
(void)remove(p->name);
@@ -360,10 +359,9 @@
return (SNMP_ERR_GENERR);
}
- strcpy(sa.sun_path, p->name);
+ strlcpy(sa.sun_path, p->name, sizeof(sa.sun_path));
sa.sun_family = AF_LOCAL;
- sa.sun_len = strlen(p->name) +
- offsetof(struct sockaddr_un, sun_path);
+ sa.sun_len = SUN_LEN(&sa);
(void)remove(p->name);
@@ -417,11 +415,78 @@
return (-1);
}
}
-
+
return (sendto(peer->input.fd, buf, len, 0, addr, addrlen));
}
+static void
+check_priv_stream(struct port_input *pi)
+{
+ struct xucred ucred;
+ socklen_t ucredlen;
+
+ /* obtain the accept time credentials */
+ ucredlen = sizeof(ucred);
+
+ if (getsockopt(pi->fd, 0, LOCAL_PEERCRED, &ucred, &ucredlen) == 0 &&
+ ucredlen >= sizeof(ucred) && ucred.cr_version == XUCRED_VERSION)
+ pi->priv = (ucred.cr_uid == 0);
+ else
+ pi->priv = 0;
+}
+
/*
+ * Receive something
+ */
+static ssize_t
+lsock_recv(struct tport *tp __unused, struct port_input *pi)
+{
+ struct msghdr msg;
+ struct iovec iov[1];
+ ssize_t len;
+
+ msg.msg_control = NULL;
+ msg.msg_controllen = 0;
+
+ if (pi->buf == NULL) {
+ /* no buffer yet - allocate one */
+ if ((pi->buf = buf_alloc(0)) == NULL) {
+ /* ups - could not get buffer. Return an error
+ * the caller must close the transport. */
+ return (-1);
+ }
+ pi->buflen = buf_size(0);
+ pi->consumed = 0;
+ pi->length = 0;
+ }
+
+ /* try to get a message */
+ msg.msg_name = pi->peer;
+ msg.msg_namelen = pi->peerlen;
+ msg.msg_iov = iov;
+ msg.msg_iovlen = 1;
+ msg.msg_control = NULL;
+ msg.msg_controllen = 0;
+ msg.msg_flags = 0;
+
+ iov[0].iov_base = pi->buf + pi->length;
+ iov[0].iov_len = pi->buflen - pi->length;
+
+ len = recvmsg(pi->fd, &msg, 0);
+
+ if (len == -1 || len == 0)
+ /* receive error */
+ return (-1);
+
+ pi->length += len;
+
+ if (pi->cred)
+ check_priv_stream(pi);
+
+ return (0);
+}
+
+/*
* Dependency to create a lsock port
*/
struct lsock_dep {
Modified: trunk/contrib/bsnmp/snmpd/trans_lsock.h
===================================================================
--- trunk/contrib/bsnmp/snmpd/trans_lsock.h 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmpd/trans_lsock.h 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Modified: trunk/contrib/bsnmp/snmpd/trans_udp.c
===================================================================
--- trunk/contrib/bsnmp/snmpd/trans_udp.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmpd/trans_udp.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -32,7 +32,9 @@
*/
#include <sys/types.h>
#include <sys/queue.h>
+#include <sys/ucred.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <syslog.h>
#include <string.h>
@@ -54,6 +56,7 @@
static int udp_init_port(struct tport *);
static ssize_t udp_send(struct tport *, const u_char *, size_t,
const struct sockaddr *, size_t);
+static ssize_t udp_recv(struct tport *, struct port_input *);
/* exported */
const struct transport_def udp_trans = {
@@ -63,7 +66,8 @@
udp_stop,
udp_close_port,
udp_init_port,
- udp_send
+ udp_send,
+ udp_recv
};
static struct transport *my_trans;
@@ -116,13 +120,15 @@
addr.sin_port = htons(p->port);
addr.sin_family = AF_INET;
addr.sin_len = sizeof(addr);
- if (addr.sin_addr.s_addr == INADDR_ANY &&
- setsockopt(p->input.fd, IPPROTO_IP, IP_RECVDSTADDR, &on,
- sizeof(on)) == -1) {
- syslog(LOG_ERR, "setsockopt(IP_RECVDSTADDR): %m");
- close(p->input.fd);
- p->input.fd = -1;
- return (SNMP_ERR_GENERR);
+ if (addr.sin_addr.s_addr == INADDR_ANY) {
+ if (setsockopt(p->input.fd, IPPROTO_IP, IP_RECVDSTADDR, &on,
+ sizeof(on)) == -1) {
+ syslog(LOG_ERR, "setsockopt(IP_RECVDSTADDR): %m");
+ close(p->input.fd);
+ p->input.fd = -1;
+ return (SNMP_ERR_GENERR);
+ }
+ p->recvdstaddr = true;
}
if (bind(p->input.fd, (struct sockaddr *)&addr, sizeof(addr))) {
if (errno == EADDRNOTAVAIL) {
@@ -214,11 +220,124 @@
const struct sockaddr *addr, size_t addrlen)
{
struct udp_port *p = (struct udp_port *)tp;
+ struct cmsghdr *cmsg;
+ struct msghdr msg;
+ char cbuf[CMSG_SPACE(sizeof(struct in_addr))];
+ struct iovec iov;
- return (sendto(p->input.fd, buf, len, 0, addr, addrlen));
+ iov.iov_base = __DECONST(void*, buf);
+ iov.iov_len = len;
+
+ msg.msg_flags = 0;
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 1;
+ msg.msg_name = __DECONST(void *, addr);
+ msg.msg_namelen = addrlen;
+
+ if (p->recvdstaddr) {
+ msg.msg_control = cbuf;
+ msg.msg_controllen = sizeof(cbuf);
+
+ cmsg = CMSG_FIRSTHDR(&msg);
+ cmsg->cmsg_level = IPPROTO_IP;
+ cmsg->cmsg_type = IP_SENDSRCADDR;
+ cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_addr));
+ memcpy(CMSG_DATA(cmsg), &p->dstaddr, sizeof(struct in_addr));
+ } else {
+ msg.msg_control = NULL;
+ msg.msg_controllen = 0;
+ }
+
+ return (sendmsg(p->input.fd, &msg, 0));
}
+static void
+check_priv_dgram(struct port_input *pi, struct sockcred *cred)
+{
+
+ /* process explicitly sends credentials */
+ if (cred)
+ pi->priv = (cred->sc_euid == 0);
+ else
+ pi->priv = 0;
+}
+
/*
+ * Input from a datagram socket.
+ * Each receive should return one datagram.
+ */
+static ssize_t
+udp_recv(struct tport *tp, struct port_input *pi)
+{
+ u_char embuf[1000];
+ char cbuf[CMSG_SPACE(SOCKCREDSIZE(CMGROUP_MAX)) +
+ CMSG_SPACE(sizeof(struct in_addr))];
+ struct udp_port *p = (struct udp_port *)tp;
+ struct msghdr msg;
+ struct iovec iov[1];
+ ssize_t len;
+ struct cmsghdr *cmsg;
+ struct sockcred *cred = NULL;
+
+ if (pi->buf == NULL) {
+ /* no buffer yet - allocate one */
+ if ((pi->buf = buf_alloc(0)) == NULL) {
+ /* ups - could not get buffer. Read away input
+ * and drop it */
+ (void)recvfrom(pi->fd, embuf, sizeof(embuf),
+ 0, NULL, NULL);
+ /* return error */
+ return (-1);
+ }
+ pi->buflen = buf_size(0);
+ }
+
+ /* try to get a message */
+ msg.msg_name = pi->peer;
+ msg.msg_namelen = pi->peerlen;
+ msg.msg_iov = iov;
+ msg.msg_iovlen = 1;
+ memset(cbuf, 0, sizeof(cbuf));
+ msg.msg_control = cbuf;
+ msg.msg_controllen = sizeof(cbuf);
+ msg.msg_flags = 0;
+
+ iov[0].iov_base = pi->buf;
+ iov[0].iov_len = pi->buflen;
+
+ len = recvmsg(pi->fd, &msg, 0);
+
+ if (len == -1 || len == 0)
+ /* receive error */
+ return (-1);
+
+ if (msg.msg_flags & MSG_TRUNC) {
+ /* truncated - drop */
+ snmpd_stats.silentDrops++;
+ snmpd_stats.inTooLong++;
+ return (-1);
+ }
+
+ pi->length = (size_t)len;
+
+ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL;
+ cmsg = CMSG_NXTHDR(&msg, cmsg)) {
+ if (cmsg->cmsg_level == IPPROTO_IP &&
+ cmsg->cmsg_type == IP_RECVDSTADDR)
+ memcpy(&p->dstaddr, CMSG_DATA(cmsg),
+ sizeof(struct in_addr));
+ if (cmsg->cmsg_level == SOL_SOCKET &&
+ cmsg->cmsg_type == SCM_CREDS)
+ cred = (struct sockcred *)CMSG_DATA(cmsg);
+ }
+
+ if (pi->cred)
+ check_priv_dgram(pi, cred);
+
+ return (0);
+}
+
+/*
* Port table
*/
int
Modified: trunk/contrib/bsnmp/snmpd/trans_udp.h
===================================================================
--- trunk/contrib/bsnmp/snmpd/trans_udp.h 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmpd/trans_udp.h 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
* All rights reserved.
*
* Author: Harti Brandt <harti at freebsd.org>
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -39,6 +39,9 @@
struct port_input input; /* common input stuff */
struct sockaddr_in ret; /* the return address */
+
+ bool recvdstaddr; /* IP_RECVDSTADDR is on */
+ struct in_addr dstaddr; /* address the request was sent to */
};
/* argument for open call */
Modified: trunk/contrib/bsnmp/snmpd/trap.c
===================================================================
--- trunk/contrib/bsnmp/snmpd/trap.c 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmpd/trap.c 2018-06-19 14:44:12 UTC (rev 11089)
@@ -19,7 +19,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -60,15 +60,15 @@
struct trapsink_list trapsink_list = TAILQ_HEAD_INITIALIZER(trapsink_list);
/* List of target addresses */
-struct target_addresslist target_addresslist =
+static struct target_addresslist target_addresslist =
SLIST_HEAD_INITIALIZER(target_addresslist);
/* List of target parameters */
-struct target_paramlist target_paramlist =
+static struct target_paramlist target_paramlist =
SLIST_HEAD_INITIALIZER(target_paramlist);
/* List of notification targets */
-struct target_notifylist target_notifylist =
+static struct target_notifylist target_notifylist =
SLIST_HEAD_INITIALIZER(target_notifylist);
static const struct asn_oid oid_begemotTrapSinkTable =
@@ -117,7 +117,7 @@
return (SNMP_ERR_RES_UNAVAIL);
}
(void)shutdown(t->socket, SHUT_RD);
-
+ memset(&sa, 0, sizeof(sa));
sa.sin_len = sizeof(sa);
sa.sin_family = AF_INET;
sa.sin_addr.s_addr = htonl((t->index.subs[0] << 24) |
@@ -214,7 +214,7 @@
t->version = tdep->rb_version;
if (tdep->set & TDEP_COMM)
strcpy(t->comm, tdep->rb_comm);
-
+
return (SNMP_ERR_NOERROR);
}
@@ -422,7 +422,7 @@
const struct asn_oid *trap_oid)
{
memset(pdu, 0, sizeof(*pdu));
- strcpy(pdu->community, com);
+ strlcpy(pdu->community, com, sizeof(pdu->community));
pdu->version = SNMP_V1;
pdu->type = SNMP_PDU_TRAP;
@@ -439,7 +439,7 @@
const struct asn_oid *trap_oid)
{
memset(pdu, 0, sizeof(*pdu));
- strcpy(pdu->community, com);
+ strlcpy(pdu->community, com, sizeof(pdu->community));
pdu->version = SNMP_V2c;
pdu->type = SNMP_PDU_TRAP2;
@@ -464,7 +464,6 @@
snmp_create_v3_trap(struct snmp_pdu *pdu, struct target_param *target,
const struct asn_oid *trap_oid)
{
- uint64_t etime;
struct usm_user *usmuser;
memset(pdu, 0, sizeof(*pdu));
@@ -487,14 +486,7 @@
pdu->nbindings = 2;
- etime = (get_ticks() - start_tick) / 100ULL;
- if (etime < INT32_MAX)
- snmpd_engine.engine_time = etime;
- else {
- start_tick = get_ticks();
- set_snmpd_engine();
- snmpd_engine.engine_time = start_tick;
- }
+ update_snmpd_engine_time();
memcpy(pdu->engine.engine_id, snmpd_engine.engine_id,
snmpd_engine.engine_len);
@@ -546,7 +538,7 @@
TAILQ_FOREACH(t, &trapsink_list, link) {
if (t->status != TRAPSINK_ACTIVE)
continue;
-
+
if (t->version == TRAPSINK_V1)
snmp_create_v1_trap(&pdu, t->comm, trap_oid);
else
@@ -725,6 +717,7 @@
}
(void)shutdown(addrs->socket, SHUT_RD);
+ memset(&sa, 0, sizeof(sa));
sa.sin_len = sizeof(sa);
sa.sin_family = AF_INET;
Modified: trunk/contrib/bsnmp/snmpd/tree.def
===================================================================
--- trunk/contrib/bsnmp/snmpd/tree.def 2018-06-19 14:40:33 UTC (rev 11088)
+++ trunk/contrib/bsnmp/snmpd/tree.def 2018-06-19 14:44:12 UTC (rev 11089)
@@ -4,7 +4,7 @@
# All rights reserved.
#
# Author: Harti Brandt <harti at freebsd.org>
-#
+#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@@ -13,7 +13,7 @@
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
-#
+#
# THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -48,7 +48,7 @@
(1 system
#
# The standard System group
-#
+#
(1 sysDescr OCTETSTRING op_system_group GET)
(2 sysObjectId OID op_system_group GET)
(3 sysUpTime TIMETICKS op_system_group GET)
More information about the Midnightbsd-cvs
mailing list