summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsnmpd
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/bsnmpd')
-rw-r--r--usr.sbin/bsnmpd/modules/Makefile4
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt4
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_atm/Makefile2
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c30
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_hast/Makefile4
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_hostres/BEGEMOT-HOSTRES-MIB.txt3
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_hostres/Makefile6
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_mibII/Makefile6
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_netgraph/BEGEMOT-NETGRAPH.txt13
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_target/Makefile2
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_usm/Makefile2
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_vacm/Makefile2
-rw-r--r--usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c38
13 files changed, 73 insertions, 43 deletions
diff --git a/usr.sbin/bsnmpd/modules/Makefile b/usr.sbin/bsnmpd/modules/Makefile
index 09598b3..177909c 100644
--- a/usr.sbin/bsnmpd/modules/Makefile
+++ b/usr.sbin/bsnmpd/modules/Makefile
@@ -2,7 +2,7 @@
.include <bsd.own.mk>
-.PATH: ${.CURDIR}/../../../contrib/bsnmp/snmpd
+.PATH: ${SRCTOP}/contrib/bsnmp/snmpd
.if ${MK_ATM} != "no"
_snmp_atm= snmp_atm
@@ -35,4 +35,6 @@ SUBDIR+=snmp_wlan
INCS= snmpmod.h
INCSDIR= ${INCLUDEDIR}/bsnmp
+SUBDIR_TARGETS+= smilint
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt b/usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt
index 85339a3..f288741 100644
--- a/usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt
+++ b/usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt
@@ -56,7 +56,9 @@ begemotAtmFreeBSDGroup MODULE-IDENTITY
E-mail: harti@freebsd.org"
DESCRIPTION
"The FreeBSD specific Begemot MIB for ATM interfaces."
-
+ REVISION "200408060000Z"
+ DESCRIPTION
+ "Initial revision."
::= { begemotAtmSysGroup 1 }
-- Netgraph
diff --git a/usr.sbin/bsnmpd/modules/snmp_atm/Makefile b/usr.sbin/bsnmpd/modules/snmp_atm/Makefile
index 4bba7cb..82bd325 100644
--- a/usr.sbin/bsnmpd/modules/snmp_atm/Makefile
+++ b/usr.sbin/bsnmpd/modules/snmp_atm/Makefile
@@ -2,7 +2,7 @@
#
# Author: Harti Brandt <harti@freebsd.org>
-CONTRIB= ${.CURDIR}/../../../../contrib/ngatm
+CONTRIB= ${SRCTOP}/contrib/ngatm
.PATH: ${CONTRIB}/snmp_atm
MOD= atm
diff --git a/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c b/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c
index 9caa331..0332f13 100644
--- a/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c
+++ b/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c
@@ -485,7 +485,7 @@ bridge_set_if_up(const char* b_name, int8_t up)
struct ifreq ifr;
bzero(&ifr, sizeof(ifr));
- strcpy(ifr.ifr_name, b_name);
+ strlcpy(ifr.ifr_name, b_name, sizeof(ifr.ifr_name));
if (ioctl(sock, SIOCGIFFLAGS, (caddr_t) &ifr) < 0) {
syslog(LOG_ERR, "set bridge up: ioctl(SIOCGIFFLAGS) "
"failed: %s", strerror(errno));
@@ -516,7 +516,7 @@ bridge_create(const char *b_name)
struct ifreq ifr;
bzero(&ifr, sizeof(ifr));
- strcpy(ifr.ifr_name, b_name);
+ strlcpy(ifr.ifr_name, b_name, sizeof(ifr.ifr_name));
if (ioctl(sock, SIOCIFCREATE, &ifr) < 0) {
syslog(LOG_ERR, "create bridge: ioctl(SIOCIFCREATE) "
@@ -549,7 +549,7 @@ bridge_destroy(const char *b_name)
struct ifreq ifr;
bzero(&ifr, sizeof(ifr));
- strcpy(ifr.ifr_name, b_name);
+ strlcpy(ifr.ifr_name, b_name, sizeof(ifr.ifr_name));
if (ioctl(sock, SIOCIFDESTROY, &ifr) < 0) {
syslog(LOG_ERR, "destroy bridge: ioctl(SIOCIFDESTROY) "
@@ -1459,9 +1459,9 @@ bridge_get_pfval(uint8_t which)
int32_t
bridge_do_pfctl(int32_t bridge_ctl, enum snmp_op op, int32_t *val)
{
- char mib_name[100];
- int32_t i, s_i;
+ char *mib_oid;
size_t len, s_len;
+ int32_t i, s_i;
if (bridge_ctl >= LEAF_begemotBridgeLayer2PfStatus)
return (-2);
@@ -1474,19 +1474,24 @@ bridge_do_pfctl(int32_t bridge_ctl, enum snmp_op op, int32_t *val)
len = sizeof(i);
- strcpy(mib_name, bridge_sysctl);
+ asprintf(&mib_oid, "%s%s", bridge_sysctl,
+ bridge_pf_sysctl[bridge_ctl].name);
+ if (mib_oid == NULL)
+ return (-1);
- if (sysctlbyname(strcat(mib_name,
- bridge_pf_sysctl[bridge_ctl].name), &i, &len,
- (op == SNMP_OP_SET ? &s_i : NULL), s_len) == -1) {
- syslog(LOG_ERR, "sysctl(%s%s) failed - %s", bridge_sysctl,
- bridge_pf_sysctl[bridge_ctl].name, strerror(errno));
+ if (sysctlbyname(mib_oid, &i, &len, (op == SNMP_OP_SET ? &s_i : NULL),
+ s_len) == -1) {
+ syslog(LOG_ERR, "sysctl(%s) failed - %s", mib_oid,
+ strerror(errno));
+ free(mib_oid);
return (-1);
}
bridge_pf_sysctl[bridge_ctl].val = i;
*val = i;
+ free(mib_oid);
+
return (i);
}
@@ -1495,8 +1500,7 @@ bridge_pf_dump(void)
{
uint8_t i;
- for (i = 0; i < sizeof(bridge_pf_sysctl) / sizeof(bridge_pf_sysctl[0]);
- i++) {
+ for (i = 0; i < nitems(bridge_pf_sysctl); i++) {
syslog(LOG_ERR, "%s%s = %d", bridge_sysctl,
bridge_pf_sysctl[i].name, bridge_pf_sysctl[i].val);
}
diff --git a/usr.sbin/bsnmpd/modules/snmp_hast/Makefile b/usr.sbin/bsnmpd/modules/snmp_hast/Makefile
index 6369918..d16d93c 100644
--- a/usr.sbin/bsnmpd/modules/snmp_hast/Makefile
+++ b/usr.sbin/bsnmpd/modules/snmp_hast/Makefile
@@ -2,7 +2,7 @@
.include <bsd.own.mk>
-.PATH: ${.CURDIR}/../../../../sbin/hastd
+.PATH: ${SRCTOP}/sbin/hastd
MOD= hast
SRCS= ebuf.c
@@ -18,7 +18,7 @@ MAN= snmp_hast.3
NO_WFORMAT=
NO_WCAST_ALIGN=
NO_WMISSING_VARIABLE_DECLARATIONS=
-CFLAGS+=-I${.CURDIR}/../../../../sbin/hastd
+CFLAGS+=-I${SRCTOP}/sbin/hastd
CFLAGS+=-DHAVE_CAPSICUM
CFLAGS+=-DINET
.if ${MK_INET6_SUPPORT} != "no"
diff --git a/usr.sbin/bsnmpd/modules/snmp_hostres/BEGEMOT-HOSTRES-MIB.txt b/usr.sbin/bsnmpd/modules/snmp_hostres/BEGEMOT-HOSTRES-MIB.txt
index ee8d284..3c15e09 100644
--- a/usr.sbin/bsnmpd/modules/snmp_hostres/BEGEMOT-HOSTRES-MIB.txt
+++ b/usr.sbin/bsnmpd/modules/snmp_hostres/BEGEMOT-HOSTRES-MIB.txt
@@ -54,6 +54,9 @@ begemotHostres MODULE-IDENTITY
E-mail: harti@freebsd.org"
DESCRIPTION
"The MIB for additional HOST-RESOURCES data."
+ REVISION "200601030000Z"
+ DESCRIPTION
+ "Initial revision."
::= { begemot 202 }
begemotHostresObjects OBJECT IDENTIFIER ::= { begemotHostres 1 }
diff --git a/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile b/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile
index 2922f45..b888384 100644
--- a/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile
+++ b/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile
@@ -28,7 +28,7 @@
# $FreeBSD$
#
-LPRSRC= ${.CURDIR}/../../../lpr/common_source
+LPRSRC= ${SRCTOP}/usr.sbin/lpr/common_source
.PATH: ${LPRSRC}
MOD= hostres
@@ -76,7 +76,3 @@ LDADD= -lkvm -ldevinfo -lm -lgeom -lmemstat
printcap.So: printcap.c
${CC} ${PICFLAG} -DPIC ${CFLAGS:C/^-W.*//} -c ${.IMPSRC} -o ${.TARGET}
-
-smilint:
- env SMIPATH=.:/usr/share/snmp/mibs:/usr/local/share/snmp/mibs \
- smilint -c /dev/null -l6 -i group-membership BEGEMOT-HOSTRES-MIB
diff --git a/usr.sbin/bsnmpd/modules/snmp_mibII/Makefile b/usr.sbin/bsnmpd/modules/snmp_mibII/Makefile
index 278dc24..22be412 100644
--- a/usr.sbin/bsnmpd/modules/snmp_mibII/Makefile
+++ b/usr.sbin/bsnmpd/modules/snmp_mibII/Makefile
@@ -2,7 +2,7 @@
#
# Author: Harti Brandt <harti@freebsd.org>
-CONTRIB= ${.CURDIR}/../../../../contrib/bsnmp
+CONTRIB= ${SRCTOP}/contrib/bsnmp
.PATH: ${CONTRIB}/snmp_mibII
MOD= mibII
@@ -21,7 +21,3 @@ INCS= snmp_${MOD}.h
BMIBS= BEGEMOT-IP-MIB.txt BEGEMOT-MIB2-MIB.txt
.include <bsd.snmpmod.mk>
-
-smilint:
- env SMIPATH=/usr/share/snmp/mibs:/usr/local/share/snmp/mibs \
- smilint -c /dev/null -l6 -i group-membership ${BMIBS:C/^/${CONTRIB}\/snmp_mibII\//}
diff --git a/usr.sbin/bsnmpd/modules/snmp_netgraph/BEGEMOT-NETGRAPH.txt b/usr.sbin/bsnmpd/modules/snmp_netgraph/BEGEMOT-NETGRAPH.txt
index 1896fe6..b4f0e2a 100644
--- a/usr.sbin/bsnmpd/modules/snmp_netgraph/BEGEMOT-NETGRAPH.txt
+++ b/usr.sbin/bsnmpd/modules/snmp_netgraph/BEGEMOT-NETGRAPH.txt
@@ -59,6 +59,19 @@ begemotNg MODULE-IDENTITY
E-mail: harti@freebsd.org"
DESCRIPTION
"The MIB for the NetGraph access module for SNMP."
+ REVISION "200311140000Z"
+ DESCRIPTION
+ "The maximum width of the following OCTET STRINGs was increased
+ from 15 to 31:
+
+ - NgTypeName
+ - NgNodeName
+ - NgNodeNameOrEmpty
+ - NgHookName
+ "
+ REVISION "200201310000Z"
+ DESCRIPTION
+ "Initial revision."
::= { begemot 2 }
begemotNgObjects OBJECT IDENTIFIER ::= { begemotNg 1 }
diff --git a/usr.sbin/bsnmpd/modules/snmp_target/Makefile b/usr.sbin/bsnmpd/modules/snmp_target/Makefile
index e6216ea..b25e9f8 100644
--- a/usr.sbin/bsnmpd/modules/snmp_target/Makefile
+++ b/usr.sbin/bsnmpd/modules/snmp_target/Makefile
@@ -2,7 +2,7 @@
#
# Author: Shteryana Shopova <syrinx@freebsd.org>
-CONTRIB= ${.CURDIR}/../../../../contrib/bsnmp
+CONTRIB= ${SRCTOP}/contrib/bsnmp
.PATH: ${CONTRIB}/snmp_target
MOD= target
diff --git a/usr.sbin/bsnmpd/modules/snmp_usm/Makefile b/usr.sbin/bsnmpd/modules/snmp_usm/Makefile
index 1c42245..f3c10fa 100644
--- a/usr.sbin/bsnmpd/modules/snmp_usm/Makefile
+++ b/usr.sbin/bsnmpd/modules/snmp_usm/Makefile
@@ -2,7 +2,7 @@
#
# Author: Shteryana Shopova <syrinx@freebsd.org>
-CONTRIB= ${.CURDIR}/../../../../contrib/bsnmp
+CONTRIB= ${SRCTOP}/contrib/bsnmp
.PATH: ${CONTRIB}/snmp_usm
MOD= usm
diff --git a/usr.sbin/bsnmpd/modules/snmp_vacm/Makefile b/usr.sbin/bsnmpd/modules/snmp_vacm/Makefile
index 4a09cde..b0099fe 100644
--- a/usr.sbin/bsnmpd/modules/snmp_vacm/Makefile
+++ b/usr.sbin/bsnmpd/modules/snmp_vacm/Makefile
@@ -2,7 +2,7 @@
#
# Author: Shteryana Shopova <syrinx@freebsd.org>
-CONTRIB= ${.CURDIR}/../../../../contrib/bsnmp
+CONTRIB= ${SRCTOP}/contrib/bsnmp
.PATH: ${CONTRIB}/snmp_vacm
MOD= vacm
diff --git a/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c b/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c
index 2a214aa..cc8cc33 100644
--- a/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c
+++ b/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c
@@ -400,13 +400,16 @@ snmptool_get(struct snmp_toolinfo *snmptoolctx)
if (snmp_parse_resp(&resp, &req) >= 0) {
snmp_output_resp(snmptoolctx, &resp, NULL);
+ snmp_pdu_free(&resp);
break;
}
snmp_output_err_resp(snmptoolctx, &resp);
if (GET_PDUTYPE(snmptoolctx) == SNMP_PDU_GETBULK ||
- !ISSET_RETRY(snmptoolctx))
+ !ISSET_RETRY(snmptoolctx)) {
+ snmp_pdu_free(&resp);
break;
+ }
/*
* Loop through the object list and set object->error to the
@@ -414,15 +417,17 @@ snmptool_get(struct snmp_toolinfo *snmptoolctx)
*/
if (snmp_object_seterror(snmptoolctx,
&(resp.bindings[resp.error_index - 1]),
- resp.error_status) <= 0)
+ resp.error_status) <= 0) {
+ snmp_pdu_free(&resp);
break;
+ }
fprintf(stderr, "Retrying...\n");
snmp_pdu_free(&resp);
snmp_pdu_create(&req, GET_PDUTYPE(snmptoolctx));
}
- snmp_pdu_free(&resp);
+ snmp_pdu_free(&req);
return (0);
}
@@ -498,27 +503,29 @@ snmptool_walk(struct snmp_toolinfo *snmptoolctx)
}
outputs += rc;
- snmp_pdu_free(&resp);
- if ((u_int)rc < resp.nbindings)
+ if ((u_int)rc < resp.nbindings) {
+ snmp_pdu_free(&resp);
break;
+ }
snmpwalk_nextpdu_create(op,
&(resp.bindings[resp.nbindings - 1].var), &req);
if (op == SNMP_PDU_GETBULK)
snmpget_fix_getbulk(&req, GET_MAXREP(snmptoolctx),
GET_NONREP(snmptoolctx));
+ snmp_pdu_free(&resp);
}
/* Just in case our root was a leaf. */
if (outputs == 0) {
snmpwalk_nextpdu_create(SNMP_PDU_GET, &root, &req);
if (snmp_dialog(&req, &resp) == SNMP_CODE_OK) {
- if (snmp_parse_resp(&resp,&req) < 0)
+ if (snmp_parse_resp(&resp, &req) < 0)
snmp_output_err_resp(snmptoolctx, &resp);
else
- snmp_output_resp(snmptoolctx, &(resp), NULL);
-
+ snmp_output_resp(snmptoolctx, &resp,
+ NULL);
snmp_pdu_free(&resp);
} else
warn("Snmp dialog");
@@ -529,9 +536,12 @@ snmptool_walk(struct snmp_toolinfo *snmptoolctx)
break;
}
+ snmp_pdu_free(&req);
snmp_pdu_create(&req, op);
}
+ snmp_pdu_free(&req);
+
if (rc == 0)
return (0);
else
@@ -1089,25 +1099,29 @@ snmptool_set(struct snmp_toolinfo *snmptoolctx)
if (snmp_pdu_check(&req, &resp) > 0) {
if (GET_OUTPUT(snmptoolctx) != OUTPUT_QUIET)
snmp_output_resp(snmptoolctx, &resp, NULL);
+ snmp_pdu_free(&resp);
break;
}
snmp_output_err_resp(snmptoolctx, &resp);
- if (!ISSET_RETRY(snmptoolctx))
+ if (!ISSET_RETRY(snmptoolctx)) {
+ snmp_pdu_free(&resp);
break;
+ }
if (snmp_object_seterror(snmptoolctx,
&(resp.bindings[resp.error_index - 1]),
- resp.error_status) <= 0)
+ resp.error_status) <= 0) {
+ snmp_pdu_free(&resp);
break;
+ }
fprintf(stderr, "Retrying...\n");
snmp_pdu_free(&req);
- snmp_pdu_free(&resp);
snmp_pdu_create(&req, SNMP_PDU_SET);
}
- snmp_pdu_free(&resp);
+ snmp_pdu_free(&req);
return (0);
}
OpenPOWER on IntegriCloud