[SNMP4J] Bug: Tree walking aborts when encountering IPv6 address values

Jens Bannmann jensbannmann at incub8.de
Thu Oct 24 14:49:17 CEST 2013


Hi,

in our project, we use SNMP4J for communicating with printers - among other
functions, we use TreeUtils.walk() to "scan" the whole MIB tree.

Recently, using SNMP4J 2.1.0, we ran into problems with a printer (Kyocera
3050ci) that returns IPv6 addresses (16 bytes) for several OIDs. As far as
I understood the SMI spec, it only allows 4-byte addresses and thus does
not support IPv6 at all - which means that SNMP4J does not have to handle
such cases. However, it also does not simply ignore it - the tree walking
stops and logs the following exception on stderr:

java.io.IOException: IpAddress encoding error, wrong length: 16
	at org.snmp4j.smi.IpAddress.decodeBER(IpAddress.java:166)
	at org.snmp4j.smi.AbstractVariable.createFromBER(AbstractVariable.java:172)
	at org.snmp4j.smi.VariableBinding.decodeBER(VariableBinding.java:167)
	at org.snmp4j.PDUv1.decodeBER(PDUv1.java:186)
	at org.snmp4j.mp.MPv1.prepareDataElements(MPv1.java:191)
	at org.snmp4j.MessageDispatcherImpl.dispatchMessage(MessageDispatcherImpl.java:272)
	at org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:368)
	at org.snmp4j.MessageDispatcherImpl.processMessage(MessageDispatcherImpl.java:328)
	at org.snmp4j.transport.AbstractTransportMapping.fireProcessMessage(AbstractTransportMapping.java:76)
	at org.snmp4j.transport.DefaultUdpTransportMapping$ListenThread.run(DefaultUdpTransportMapping.java:378)
	at java.lang.Thread.run(Unknown Source)

We therefore never get the full subtree. To solve this problem, we forked
the SNMP4J library and changed the code so that tree walking continues.
Note that the relevant code is unchanged in version 2.2.2.

However, we would very much like to drop that fork and return to a regular
release.

Note: Microsoft's command-line tool "snmputil" simply lists these entries
as "Invalid", but continues walking the tree.

Best regards,
Jens Bannmann
-- 
incub8 Software Labs UG (haftungsbeschränkt)
Pulverstraße 1 | 44225 Dortmund, Germany
+49 (0)231 53223933 | info at incub8.de | http://www.incub8.de/

Geschäftsführer: Jan Dörrenhaus | Sitz: Dortmund
Registergericht: Amtsgericht Dortmund - HRB 25457
Steuernummer: 315/5748/1377 | USt.-Id.: DE287331286

Bankverbindung: Sparkasse Dortmund
Kto.-Nr.: 911008424 | BLZ: 440 501 99
IBAN: DE64440501990911008424 | BIC: DORTDE33



More information about the SNMP4J mailing list