[jboss-user] [Management, JMX/JBoss] - Wrong implementation of "compareOid" method in RequestHandle
emailmsgbox
do-not-reply at jboss.com
Mon Aug 28 03:33:15 EDT 2006
The implementation states in its Javadoc:
@return 0 when equal, 1 if oid2 > oid1 and -1 if oid1>oid2
However, the implementation is wrong in its code:
int res;
int nd1 = countDots(oid1);
int nd2 = countDots(oid2);
res = nd1 - nd2;
if (res != 0) // different number of dots -> not equal
return res;
while it is true that a different number of dots means that OID(s) are not equal, it is most definitely NOT true that OID1 < OID2 if it is shorter. What matters is the VALUE of the FIRST non-matching OID component - e.g.:
1.2.4.1.1 < 1.3.6 even though 1.3.6 is the shorter OID
the correct implementation is to go component by component untill the first non-equal value is found. If one of the OID(s) is "exhausted" (i.e., it is a prefix of the other) then the shorter one comes first.
This mis-implementation causes a BUG in SNMP GETNEXT behavior as it returns WRONG OID(s). In this context, "compareOid" should be used to find the first OID that is GREATER than the requested one and NOT less than - as is currently the (wrong) implementation of the "getNextOid" method.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3967751#3967751
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3967751
More information about the jboss-user
mailing list