Closed ZaneXo closed 1 year ago
@bug:[#17](bug:oidToByteString (#17))bug:oidToByteString (https://github.com/slayercat/GoSNMPServer/pull/17)
It does cause problems exactly as stated over the function comment. First, if you try to load any walks from real world and a complicated device during sync function sort triggers the rune bug and you get missing/duplicate oids which prevets server from starting. Second problem occurs during getPDU value function. In sort search when you do comparison on both oids, it triggers the bug again resulting in getnext or walk on client side getting wrong oid order error. I found a working solution for both problems before stumbling on this post, ill test if reverting changes fixes the issue. If not I'll post a PR after some more research and validation.
Why implement oidToByteString like the following, each time a new request is received, such as Get, Get-Next, it will perform multiple oidToByteString operations, there is additional cpu overhead, and this algorithm still has BUG :
Input oids as:
Error Result as:
Why not return the oid string directly, use the oid string to sort and search the slice,like:
Will doing this cause any problems? If it is to verify the legitimacy of the OID, is it more appropriate to only perform the verification in SyncConfig, not when subsequent new requests flow in?