Hi. I was debugging some v3 traps and found an old SNMP4J question from 2012 that was useful. However, in that issue, the author also observed that the error indicator did not increment. He got, “1.3.6.1.6.3.15.1.1.5.2.0 = 0”. That observation wasn’t really addressed in your response. Then I noticed the same zero in my errors. So I looked at my latest copy of SNMP4J (version 3.4.2) and in USM.java, around line 700 is the following switch statement. Notice that the event is a new CounterEvent every time, and it is never incremented. Is that perhaps a mistake, or intentional?
Thanks!
Chris
switch (status) {
case SnmpConstants.SNMPv3_USM_NOT_IN_TIME_WINDOW: {
logger.debug("RFC3414-3.2.7.a Not in time window; engineID='" +
securityEngineID +
"', engineBoots=" +
usmSecurityParameters.getAuthoritativeEngineBoots() +
", engineTime=" +
usmSecurityParameters.getAuthoritativeEngineTime());
CounterEvent **event** = new CounterEvent(this, SnmpConstants.usmStatsNotInTimeWindows);
fireIncrementCounter(**event**);
statusInfo.setSecurityLevel(new Integer32(SecurityLevel.AUTH_NOPRIV));
statusInfo.setErrorIndication(new VariableBinding(**event**.getOid(), **event**.getCurrentValue()));
return status;
}
case SnmpConstants.SNMPv3_USM_UNKNOWN_ENGINEID: {
if (logger.isDebugEnabled()) {
logger.debug("RFC3414-3.2.7.b - Unknown engine ID: " + securityEngineID);
}
CounterEvent **event** = new CounterEvent(this, SnmpConstants.usmStatsUnknownEngineIDs);
fireIncrementCounter(**event**);
if (SNMP4JSettings.getReportSecurityLevelStrategy() ==
SNMP4JSettings.ReportSecurityLevelStrategy.noAuthNoPrivIfNeeded) {
statusInfo.setSecurityLevel(new Integer32(SecurityLevel.NOAUTH_NOPRIV));
}
statusInfo.setErrorIndication(new VariableBinding(**event**.getOid(), **event**.getCurrentValue()));
return status;
}
}