Merge branch 'V5-4-patches' of ssh://git.code.sf.net/p/net-snmp/code into V5-4-patches
diff --git a/Makefile.in b/Makefile.in
index 17816bd..0ea41aa 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -18,7 +18,8 @@
INCLUDESUBDIRHEADERS= aix.h bsd.h bsdi3.h bsdi4.h bsdi.h cygwin.h \
darwin.h darwin7.h darwin8.h darwin9.h dynix.h \
freebsd2.h freebsd3.h freebsd4.h freebsd5.h freebsd6.h \
- freebsd7.h freebsd8.h freebsd9.h freebsd10.h freebsd.h \
+ freebsd7.h freebsd8.h freebsd9.h freebsd10.h freebsd11.h \
+ freebsd12.h freebsd.h \
generic.h hpux.h \
irix.h linux.h mingw32.h mips.h netbsd.h osf5.h \
openbsd.h openbsd5.h openbsd4.h \
diff --git a/agent/mibgroup/disman/expr/expExpressionConf.c b/agent/mibgroup/disman/expr/expExpressionConf.c
index 743ef9d..61744e1 100644
--- a/agent/mibgroup/disman/expr/expExpressionConf.c
+++ b/agent/mibgroup/disman/expr/expExpressionConf.c
@@ -134,7 +134,7 @@
* object name into the expression field...
*/
/* XXX - TODO - Handle string literals */
- if (!isalpha(*cp)) {
+ if (!isalpha(*cp & 0xFF)) {
*cp2++ = *cp++;
continue;
}
diff --git a/agent/mibgroup/disman/expr/expValue.c b/agent/mibgroup/disman/expr/expValue.c
index 46638f2..eeff402 100644
--- a/agent/mibgroup/disman/expr/expValue.c
+++ b/agent/mibgroup/disman/expr/expValue.c
@@ -230,7 +230,7 @@
n = atoi(start);
for (cp=start; *cp; cp++)
- if (!isdigit(*cp))
+ if (!isdigit(*cp & 0xFF))
break;
*end = cp;
return n;
@@ -565,7 +565,7 @@
break;
default:
- if (isalpha( *cp1 )) {
+ if (isalpha( *cp1 & 0xFF )) {
/*
* Unrecognised function call ?
*/
@@ -576,7 +576,7 @@
var->data = (void *)(cp1 - exprRaw);
return var;
}
- else if (!isspace( *cp1 )) {
+ else if (!isspace( *cp1 & 0xFF )) {
/*
* Unrecognised operator ?
*/
diff --git a/agent/mibgroup/hardware/cpu/cpu_perfstat.c b/agent/mibgroup/hardware/cpu/cpu_perfstat.c
index b714ed4..f44f295 100644
--- a/agent/mibgroup/hardware/cpu/cpu_perfstat.c
+++ b/agent/mibgroup/hardware/cpu/cpu_perfstat.c
@@ -87,7 +87,7 @@
strcpy( name.name, "");
if (perfstat_cpu(&name, cs2, sizeof(perfstat_cpu_t), n) > 0) {
for ( i = 0; i < n; i++ ) {
- cpu = netsnmp_cpu_get_byIdx( i, 0 );
+ cpu = netsnmp_cpu_get_byIdx( i, 1 );
cpu->user_ticks = (unsigned long long)cs2[i].user;
cpu->sys_ticks = (unsigned long long)cs2[i].sys + (unsigned long long)cs2[i].wait;
cpu->kern_ticks = (unsigned long long)cs2[i].sys;
diff --git a/agent/mibgroup/hardware/cpu/cpu_pstat.c b/agent/mibgroup/hardware/cpu/cpu_pstat.c
index 35c1d63..d550450 100644
--- a/agent/mibgroup/hardware/cpu/cpu_pstat.c
+++ b/agent/mibgroup/hardware/cpu/cpu_pstat.c
@@ -22,6 +22,7 @@
void init_cpu_pstat( void ) {
int i, cpuversion;
struct pst_dynamic psd;
+ struct pst_processor *psp;
char descr[ SNMP_MAXBUF ];
netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 1 );
strcpy(cpu->name, "Overall CPU statistics");
@@ -31,31 +32,49 @@
switch (cpuversion) {
case CPU_HP_MC68020:
snprintf(descr, SNMP_MAXBUF, " Motorola MC68020 ");
+ break;
case CPU_HP_MC68030:
snprintf(descr, SNMP_MAXBUF, " Motorola MC68030 ");
+ break;
case CPU_HP_MC68040:
snprintf(descr, SNMP_MAXBUF, " Motorola MC68040 ");
+ break;
case CPU_PA_RISC1_0:
snprintf(descr, SNMP_MAXBUF, " HP PA-RISC 1.0 ");
+ break;
case CPU_PA_RISC1_1:
snprintf(descr, SNMP_MAXBUF, " HP PA-RISC 1.1 ");
+ break;
case CPU_PA_RISC1_2:
snprintf(descr, SNMP_MAXBUF, " HP PA-RISC 1.2 ");
+ break;
case CPU_PA_RISC2_0:
snprintf(descr, SNMP_MAXBUF, " HP PA-RISC 2.0 ");
+ break;
default:
snprintf(descr, SNMP_MAXBUF, "An electronic chip with an HP label");
+ break;
}
#else
snprintf(descr, SNMP_MAXBUF, "An electronic chip without(?) an HP label");
#endif
+ (void)memset(&psd, 0, sizeof(struct pst_dynamic));
if (pstat_getdynamic(&psd, sizeof(psd), 1, 0) > 0) {
- for ( i = 0; i < psd.psd_proc_cnt; i++ ) {
- cpu = netsnmp_cpu_get_byIdx( i, 1 );
- sprintf( cpu->name, "cpu%d", i );
- sprintf( cpu->descr, descr );
+ size_t nspu = psd.psd_max_proc_cnt;
+ psp = (struct pst_processor *)
+ malloc(nspu * sizeof(struct pst_processor));
+ (void)memset(psp, 0, nspu * sizeof(struct pst_processor));
+ if (pstat_getprocessor(psp, sizeof(struct pst_processor), nspu, 0) != -1) {
+ for (i = 0; i < nspu; i++) {
+ if (psp[i].psp_processor_state == PSP_SPU_ENABLED) {
+ cpu = netsnmp_cpu_get_byIdx( i, 1 );
+ sprintf( cpu->name, "cpu%d", i );
+ sprintf( cpu->descr, descr );
+ }
+ }
}
+ free(psp);
}
cpu_num = psd.psd_proc_cnt;
}
@@ -64,45 +83,56 @@
/*
* Load the latest CPU usage statistics
*/
-int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) {
+int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic )
+{
int i;
struct pst_dynamic psd;
+ struct pst_processor *psp;
struct pst_vminfo psv;
netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 0 );
- pstat_getdynamic(&psd, sizeof(psd), 1, 0);
- /* XXX - Compare cpu_num against psd.psd_proc_cnt */
- cpu->user_ticks = (unsigned long long)psd.psd_cpu_time[CP_USER];
- cpu->nice_ticks = (unsigned long long)psd.psd_cpu_time[CP_NICE];
- cpu->sys2_ticks = (unsigned long long)psd.psd_cpu_time[CP_SYS]+
- psd.psd_cpu_time[CP_WAIT];
- cpu->idle_ticks = (unsigned long long)psd.psd_cpu_time[CP_IDLE];
- cpu->wait_ticks = (unsigned long long)psd.psd_cpu_time[CP_WAIT];
- cpu->kern_ticks = (unsigned long long)psd.psd_cpu_time[CP_SYS];
- /* XXX - record (sum of) "all other ticks" */
- /* intrpt_ticks, sirq_ticks unused */
+ if (pstat_getdynamic(&psd, sizeof(psd), 1, 0) > 0) {
+ size_t nspu = psd.psd_max_proc_cnt;
+ /* XXX - Compare cpu_num against psd.psd_proc_cnt */
+ cpu->user_ticks = (unsigned long long)psd.psd_cpu_time[CP_USER];
+ cpu->nice_ticks = (unsigned long long)psd.psd_cpu_time[CP_NICE];
+ cpu->sys2_ticks = (unsigned long long)psd.psd_cpu_time[CP_SYS]+
+ (unsigned long long)psd.psd_cpu_time[CP_WAIT];
+ cpu->idle_ticks = (unsigned long long)psd.psd_cpu_time[CP_IDLE];
+ cpu->wait_ticks = (unsigned long long)psd.psd_cpu_time[CP_WAIT];
+ cpu->kern_ticks = (unsigned long long)psd.psd_cpu_time[CP_SYS];
+ /* XXX - record (sum of) "all other ticks" */
+ /* intrpt_ticks, sirq_ticks unused */
- /*
- * Interrupt/Context Switch statistics
- * XXX - Do these really belong here ?
- */
- pstat_getvminfo(&psv, sizeof(psv), 1, 0);
- cpu->swapIn = (unsigned long long)psv.psv_sswpin;
- cpu->swapOut = (unsigned long long)psv.psv_sswpout;
- cpu->nInterrupts = (unsigned long long)psv.psv_sintr;
- cpu->nCtxSwitches = (unsigned long long)psv.psv_sswtch;
+ /*
+ * Interrupt/Context Switch statistics
+ * XXX - Do these really belong here ?
+ */
+ pstat_getvminfo(&psv, sizeof(psv), 1, 0);
+ cpu->swapIn = (unsigned long long)psv.psv_sswpin;
+ cpu->swapOut = (unsigned long long)psv.psv_sswpout;
+ cpu->nInterrupts = (unsigned long long)psv.psv_sintr;
+ cpu->nCtxSwitches = (unsigned long long)psv.psv_sswtch;
+ psp = (struct pst_processor *)
+ malloc(nspu * sizeof(struct pst_processor));
+ (void)memset(psp, 0, nspu * sizeof(struct pst_processor));
- for ( i = 0; i < psd.psd_proc_cnt; i++ ) {
- cpu = netsnmp_cpu_get_byIdx( i, 0 );
- cpu->user_ticks = (unsigned long long)psd.psd_mp_cpu_time[i][CP_USER];
- cpu->nice_ticks = (unsigned long long)psd.psd_mp_cpu_time[i][CP_NICE];
- cpu->sys2_ticks = (unsigned long long)psd.psd_mp_cpu_time[i][CP_SYS]+
- psd.psd_mp_cpu_time[i][CP_WAIT];
- cpu->idle_ticks = (unsigned long long)psd.psd_mp_cpu_time[i][CP_IDLE];
- cpu->wait_ticks = (unsigned long long)psd.psd_mp_cpu_time[i][CP_WAIT];
- cpu->kern_ticks = (unsigned long long)psd.psd_mp_cpu_time[i][CP_SYS];
- /* XXX - record (sum of) "all other ticks" */
+ if (pstat_getprocessor(psp, sizeof(struct pst_processor), nspu, 0) != -1) {
+ for (i = 0; i < nspu; i++) {
+ if (psp[i].psp_processor_state == PSP_SPU_ENABLED) {
+ cpu = netsnmp_cpu_get_byIdx( i, 0 );
+ cpu->user_ticks = (unsigned long long)psp[i].psp_cpu_time[CP_USER];
+ cpu->nice_ticks = (unsigned long long)psp[i].psp_cpu_time[CP_NICE];
+ cpu->sys2_ticks = (unsigned long long)psp[i].psp_cpu_time[CP_SYS]+
+ (unsigned long long)psp[i].psp_cpu_time[CP_WAIT];
+ cpu->idle_ticks = (unsigned long long)psp[i].psp_cpu_time[CP_IDLE];
+ cpu->wait_ticks = (unsigned long long)psp[i].psp_cpu_time[CP_WAIT];
+ cpu->kern_ticks = (unsigned long long)psp[i].psp_cpu_time[CP_SYS];
+ }
+ }
+ }
+ free(psp);
}
return 0;
diff --git a/agent/mibgroup/kernel_sunos5.c b/agent/mibgroup/kernel_sunos5.c
index 7d146ac..6a3b812 100644
--- a/agent/mibgroup/kernel_sunos5.c
+++ b/agent/mibgroup/kernel_sunos5.c
@@ -1604,6 +1604,8 @@
* this is good
*/
havespeed = B_TRUE;
+ } else if (getKstatInt("link", name, "ifspeed", &ifp->ifSpeed) == 0) {
+ havespeed = B_TRUE;
}
/* make ifOperStatus depend on link status if available */
diff --git a/agent/mibgroup/mibII/mta_sendmail.c b/agent/mibgroup/mibII/mta_sendmail.c
index ad64f36..5921d68 100644
--- a/agent/mibgroup/mibII/mta_sendmail.c
+++ b/agent/mibgroup/mibII/mta_sendmail.c
@@ -775,7 +775,7 @@
if (mailers < MAXMAILERS) {
for (i = 1;
- line[i] != ',' && !isspace(line[i]) && line[i] != '\0'
+ line[i] != ',' && !isspace(line[i] & 0xFF) && line[i] != '\0'
&& i <= MNAMELEN; i++) {
mailernames[mailers][i - 1] = line[i];
}
@@ -1046,7 +1046,7 @@
}
if (strcasecmp(token, "sendmail_stats") == 0) {
- while (isspace(*line)) {
+ while (isspace(*line & 0xFF)) {
line++;
}
copy_nword(line, sendmailst_fn, sizeof(sendmailst_fn));
@@ -1064,7 +1064,7 @@
"opened statistics file \"%s\"\n", sendmailst_fn));
return;
} else if (strcasecmp(token, "sendmail_config") == 0) {
- while (isspace(*line)) {
+ while (isspace(*line & 0xFF)) {
line++;
}
copy_nword(line, sendmailcf_fn, sizeof(sendmailcf_fn));
@@ -1075,14 +1075,14 @@
"read config file \"%s\"\n", sendmailcf_fn));
return;
} else if (strcasecmp(token, "sendmail_queue") == 0) {
- while (isspace(*line)) {
+ while (isspace(*line & 0xFF)) {
line++;
}
add_queuegroup("mqueue", line);
return;
} else if (strcasecmp(token, "sendmail_index") == 0) {
- while (isspace(*line)) {
+ while (isspace(*line & 0xFF)) {
line++;
}
applindex = atol(line);
@@ -1091,7 +1091,7 @@
applindex = 1;
}
} else if (strcasecmp(token, "sendmail_stats_t") == 0) {
- while (isspace(*line)) {
+ while (isspace(*line & 0xFF)) {
line++;
}
stat_cache_time = atol(line);
@@ -1100,7 +1100,7 @@
applindex = 5;
}
} else if (strcasecmp(token, "sendmail_queue_t") == 0) {
- while (isspace(*line)) {
+ while (isspace(*line & 0xFF)) {
line++;
}
dir_cache_time = atol(line);
diff --git a/agent/mibgroup/ucd-snmp/pass.c b/agent/mibgroup/ucd-snmp/pass.c
index 4a51a4b..a42a91b 100644
--- a/agent/mibgroup/ucd-snmp/pass.c
+++ b/agent/mibgroup/ucd-snmp/pass.c
@@ -139,7 +139,7 @@
1, (*ppass)->miboid, (*ppass)->miblen, priority);
/*
- * argggg -- pasthrus must be sorted
+ * argggg -- passthrus must be sorted
*/
if (numpassthrus > 1) {
etmp = (struct extensible **)
diff --git a/apps/snmpstatus.c b/apps/snmpstatus.c
index a061813..ae08369 100644
--- a/apps/snmpstatus.c
+++ b/apps/snmpstatus.c
@@ -305,6 +305,10 @@
pdu = snmp_pdu_create(SNMP_MSG_GETNEXT);
for (vars = response->variables; vars;
vars = vars->next_variable) {
+ if ((vars->type & 0xF0) == 0x80) {
+ print_variable(vars->name, vars->name_length, vars);
+ continue;
+ }
if (vars->name_length >= length_ifOperStatus
&& !memcmp(objid_ifOperStatus, vars->name,
sizeof(objid_ifOperStatus))) {
diff --git a/include/net-snmp/system/freebsd10.h b/include/net-snmp/system/freebsd10.h
index 871b9df..a7334b9 100644
--- a/include/net-snmp/system/freebsd10.h
+++ b/include/net-snmp/system/freebsd10.h
@@ -1,3 +1,3 @@
-/* freebsd9 is a superset of freebsd10 */
+/* freebsd10 is a superset of freebsd9 */
#include "freebsd9.h"
-#define freebsd10 freebsd10
+#define freebsd9 freebsd9
diff --git a/include/net-snmp/system/freebsd11.h b/include/net-snmp/system/freebsd11.h
new file mode 100644
index 0000000..e81b4cf
--- /dev/null
+++ b/include/net-snmp/system/freebsd11.h
@@ -0,0 +1,3 @@
+/* freebsd11 is a superset of freebsd10 */
+#include "freebsd10.h"
+#define freebsd10 freebsd10
diff --git a/include/net-snmp/system/freebsd12.h b/include/net-snmp/system/freebsd12.h
new file mode 100644
index 0000000..301432b
--- /dev/null
+++ b/include/net-snmp/system/freebsd12.h
@@ -0,0 +1,3 @@
+/* freebsd12 is a superset of freebsd11 */
+#include "freebsd11.h"
+#define freebsd11 freebsd11
diff --git a/include/net-snmp/system/freebsd9.h b/include/net-snmp/system/freebsd9.h
index 1bd4750..ce23322 100644
--- a/include/net-snmp/system/freebsd9.h
+++ b/include/net-snmp/system/freebsd9.h
@@ -1,3 +1,3 @@
/* freebsd9 is a superset of freebsd8 */
#include "freebsd8.h"
-#define freebsd9 freebsd9
+#define freebsd8 freebsd8
diff --git a/perl/TrapReceiver/TrapReceiver.xs b/perl/TrapReceiver/TrapReceiver.xs
index e11ef27..8713efd 100644
--- a/perl/TrapReceiver/TrapReceiver.xs
+++ b/perl/TrapReceiver/TrapReceiver.xs
@@ -81,18 +81,18 @@
STOREPDUi("securitymodel", pdu->securityModel);
STOREPDUi("securitylevel", pdu->securityLevel);
STOREPDU("contextName",
- newSVpv(pdu->contextName, pdu->contextNameLen));
+ newSVpv(pdu->contextName ? pdu->contextName : "", pdu->contextNameLen));
STOREPDU("contextEngineID",
- newSVpv((char *) pdu->contextEngineID,
+ newSVpv(pdu->contextEngineID ? (char *) pdu->contextEngineID : "",
pdu->contextEngineIDLen));
STOREPDU("securityEngineID",
- newSVpv((char *) pdu->securityEngineID,
+ newSVpv(pdu->securityEngineID ? (char *) pdu->securityEngineID : "",
pdu->securityEngineIDLen));
STOREPDU("securityName",
- newSVpv((char *) pdu->securityName, pdu->securityNameLen));
+ newSVpv(pdu->securityName ? (char *) pdu->securityName : "", pdu->securityNameLen));
} else {
STOREPDU("community",
- newSVpv((char *) pdu->community, pdu->community_len));
+ newSVpv(pdu->community ? (char *) pdu->community : "", pdu->community_len));
}
if (transport && transport->f_fmtaddr) {