3 Dec 2009 20:46
Re: SNMP4J Agent 1.3.2: NullPointer Exception when receiving GET requests with unknown community strings
Hi Gianluca,
This is indeed a bug. Although it has no security
relevance, it has regarding authenticationFailure
trap generation and counter incrementation.
The below patch fixes it:
Index: SnmpCommunityMIB.java
===================================================================
--- SnmpCommunityMIB.java (revision 1664)
+++ SnmpCommunityMIB.java (working copy)
<at> <at> -543,8 +543,10 <at> <at>
if (coexistenceInfo == null) {
return null;
}
- SortedSet cinfos = new
TreeSet((SortedSet)coexistenceInfo.get(community));
+ SortedSet cinfos = (SortedSet)coexistenceInfo.get(community);
if (cinfos != null) {
+ // make a copy to improve consistency on concurrent access
+ cinfos = new TreeSet(cinfos);
Iterator it = cinfos.iterator();
CoexistenceInfo[] infos = new CoexistenceInfo[cinfos.size()];
for (int i=0; i<infos.length; i++) {
Best regards,
Frank
Gianluca Uberti wrote:
> Hi there,
> I am trying to develop an SNMP agent capable of responding to V1 and V2c
> requests with the help of SNMP 4J Agent framework version 1.3.2;
> my community string is configured as "public"; any time the agent
> receives a V2c GET request with a community string different from
> "public", it hangs and the following exception is logged:
>
> 20091202 173258 CET [ERROR] <DefaultUDPTransportMapping> PTMA0000:
> java.lang.NullPointerException
> Trace for the exception:
> java.lang.NullPointerException
> at java.util.TreeSet.<init>(TreeSet.java:154)
> at
> org.snmp4j.agent.mo.snmp.SnmpCommunityMIB.getCoexistenceInfo(SnmpCommunityMIB.java:546)
> at
> org.snmp4j.agent.CommandProcessor.processPdu(CommandProcessor.java:116)
> at
> org.snmp4j.MessageDispatcherImpl.fireProcessPdu(MessageDispatcherImpl.java:610)
> at
> org.snmp4j.MessageDispatcherImpl.dispatchMessage(MessageDispatcherImpl.java:287)
> at
> org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:347)
> at
> org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:309)
> at
> org.snmp4j.transport.AbstractTransportMapping.fireProcessMessage(AbstractTransportMapping.java:83)
> at
> org.snmp4j.transport.DefaultUdpTransportMapping$ListenThread.run(DefaultUdpTransportMapping.java:364)
> at java.lang.Thread.run(Thread.java:619)
>
> It does seem to me an actual SNMP 4J Agent framework issue...any help is
> appreciated.
>
> Kind regards
>
> GL
>
> --
> Gianluca Uberti
> Kernel SW Engineer
> Mycom France s.a.r.l.
> t: +33 1 49 03 77 48
> f: +33 1 47 73 06 51
> e: gianluca.uberti@...
> w: www.mycom-int.com
>
> Correspondence address:
> Le Capitole - Parc des Fontaines, Batiment B - 3eme etage, 55 Avenue des Champs Pierreux, 92012 Nanterre
Cedex, France.
> RCS Paris B 428 761 266
>
> This electronic message contains information from Mycom which may be privileged or confidential. The
information is intended to be for the use of the individual(s) or entity named above. If you are not the
intended recipient, be aware that any disclosure, copying, distribution or any other use of the contents
of this information is prohibited. If you have received this electronic message in error, please notify
us by post or telephone (to the numbers or correspondence address above) or by email (at the email address
above) immediately.
>
> See us at LinkedIn: http://www.linkedin.com/companies/9323?trk=anet_cg_grppro
>
>
> This electronic message contains information from Mycom which may be privileged or confidential. The
information is intended to be for the use of the individual(s) or entity named above. If you are not the
intended recipient, be aware that any disclosure, copying, distribution or any other use of the contents
of this information is prohibited. If you have received this electronic message in error, please notify
us by post or telephone (to the numbers or correspondence address above) or by email (at the email address
above) immediately.
> _______________________________________________
> SNMP4J mailing list
> SNMP4J@...
> http://lists.agentpp.org/mailman/listinfo/snmp4j
--
--
AGENT++
http://www.agentpp.com
http://www.snmp4j.com
http://www.mibexplorer.com
http://www.mibdesigner.com
RSS Feed