[Pysnmp-dev] RE: Valid packets undecodable by pysnmp
Brought to you by:
elie
From: Ilya E. <il...@gl...> - 2002-09-20 07:25:58
|
Once again, sorry for delaying so much. I've tried to decode a few of the octet-streams you refer to so they all seem to have the same problem of malformed variables-bindings in PDU: >>>v1.decode('0^\002\001\000\004\006public\244Q\006\011+\006\001\004\001\203\004\001\010@\004\202\327\250\007\002\001\006\002\001fC\003\004\344]0301\006\015+\006\001\004\001\203\004\001\010\001\001\004\000\004\006\000\240\370\241\277\3610\030\006\016+\006\001\004\001\203\004\001\010\002\010\004\001\002\004\006\000\240\370\217}X\326zj=\003\307\000\000\212\000\000\000\212\000\000\000\000\006[\312\226D\000\340{\212\012\013\010\000E\000\000|\002\230\000\000>\021\003\013\202\327\250\007\202\327\311\030\005\217\000\242\000h\373\230') Traceback (innermost last): File "<stdin>", line 1, in ? File "v1.py", line 843, in decode rest = msg.decode(input) File "v1.py", line 590, in decode if self.bindings.decode(self.pdu['bindings']): File "v1.py", line 192, in decode return self._decode(input) File "v1.py", line 369, in _decode raise TypeError('Trailing garbage in binding: %s' % repr(binding)) v1.TypeError: Trailing garbage in binding: '0\030\006\016+\006\001\004\001\203\004\001\010\002\010\004\001\002\004\006\000\240\370\217}X' >>>asn1.decode('0\030\006\016+\006\001\004\001\203\004\001\010\002\010\004\001\002\004\006\000\240\370\217}X''0\030\006\016+\006\001\004\001\203\004\001\010\002\010\004\001\002\004\006\000\240\370\217}X') (SEQUENCE('\006\016+\006\001\004\001\203\004\001\010\002\010\004\001\002\004\006\000\240\370\217}X'), '0\030\006\016+\006\001\004\001\203\004\001\010\002\010\004\001\002\004\006\000\240\370\217}X') >>>asn1.decode('0\030\006\016+\006\001\004\001\203\004\001\010\002\010\004\001\002\004\006\000\240\370\217}X') (SEQUENCE('\006\016+\006\001\004\001\203\004\001\010\002\010\004\001\002\004\006\000\240\370\217}X'), '') >>>asn1.decode('\006\016+\006\001\004\001\203\004\001\010\002\010\004\001\002\004\006\000\240\370\217}X') (OBJECTID('.1.3.6.1.4.1.388.1.8.2.8.4.1.2'), '\004\006\000\240\370\217}X') >>> asn1.decode('\004\006\000\240\370\217}X') (OCTETSTRING('\000\240\370\217}X'), '') >>> So, this looks like this trap message produced by your device has *two* variables-bindings with a single var-bind in each instead of a single variables-bindings with two subsequent var-binds. The first var-bind carries the .1.3.6.1.4.1.388.1.8.1.1.4.0 OID and value (not shown above) while the second has .1.3.6.1.4.1.388.1.8.2.8.4.1.2 OID and value (see above). This structure seems to be invalid according to RFC1157 (only one variables-bindings structure is allowed in PDU) so that's why pysnmp can't decode it. A more relaxed approach would be to ignore the second variables-bindings in PDU (does ethereal work this way?). This can be easily implemented by subclassing and tweaking v1.BINDINGS() decode method. Please, let me know if you need any assistance on this. -ilya >From: Frank Sweetser <fes@us...> >Subject: Valid packets undecodable by pysnmp >Date: 2002-08-26 12:16 > > I've got a device (specifically, a Symbol 4131 wireless access >point) that > I'm trying to manage via pysnmp. The AP is sending out traps that >pysnmp > seems to barf on, but ethereal declares perfectly valid. > > Help! > > I've put a sample of the offending traps up at > http://erwin.wpi.edu/~fs/4131.cap |