Re: [pysnmp-users] Bug in 3.3.4 snmpwalk.py?
Brought to you by:
elie
From: Ilya E. <il...@gl...> - 2003-08-13 17:11:30
|
[ skipped ] > Error: OID not increasing: [('.1.3.6.1.2.1.10.127.1.3.3.1.3.9', > '.1.3.6.1.2.1.10.127.1.3.3.1.3.10')] > 11:03:19 mcfletch@cmon:~/pysnmp-3.3.4/examples $ > > i.e. str(10) < str(9) lexically. Line 164:173 in the source, I think > this is approximately what you want (untested as of yet, as I'm not sure > which restriction is actually intended): Right, the bug here is that OIDs here are compared as literals rather than as objects. A quick (and slightly inefficient) fix attached. I'm going to rework it shortly. [ skipped ] > or (from my current code): > > if suffix: > sentinel = oids[0].split('.') > sentinel = sentinel[:-suffix] > sentinel = ".".join(sentinel) > else: > sentinel = oids[0] > ... > if not testOID.startswith( sentinel ): > break > > but that's a very different check for "end-of-table" which assumes that > the first OID doesn't run out before everything else does, (and does no > always-increasing-numbers check). BTW, there are: ObjectIdentifier.isaprefix() method for seemingly similar purpose. Thanks, ilya |