Community discussions

MikroTik App
 
rucevzhuru
newbie
Topic Author
Posts: 43
Joined: Fri May 25, 2007 6:57 pm

API bug

Fri May 21, 2010 6:32 pm

I use php script from wiki and I think I found new api bug.

Sometimes (it's rather rare but when I run this script 100 times per day on 60 routers you can observe 40 scripts in invalid state) I get response from router (command is /interface/wireless/registration-table/getall) where first byte is correct encoded length of the following word but second byte is 0x00 and normal response starts from 3rd byte.

It causes that php script usually loop till i have to kill it (it looses synchronization and interprets bad bytes in following words as their length).

Example:

I can get this:
XY=wmm-enabled=true
where ord(X)=17 and Y=0x00.

As a response I read word as:
Y=wmm-enabled=tru
Then length of next word is ord('e') where 'e' is from word 'true'

Have you seen that?

Thanks
 
rucevzhuru
newbie
Topic Author
Posts: 43
Joined: Fri May 25, 2007 6:57 pm

Re: API bug

Sat May 22, 2010 2:05 am

I made further investigation and found that one bug divided into two different bugs.

First is as described before and second is similar to this bug observed by another user:

http://forum.mikrotik.com/viewtopic.php ... hilit=0x00

I checked incoming data from router with wireshark and found that sometimes when word length byte is first data byte of tcp packet then it consists of one more byte.

This is screenshot from wireshark:
MikrotikBug.png
Beginning of packet is at byte 2C15. There are two bytes but the length of following word is only second one. First byte is unknown to me and I very dislike it cause it kills my script.

I can present wireshark packet dump if needed.
You do not have the required permissions to view the files attached to this post.
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: API bug

Mon May 24, 2010 7:37 am

what version of RouterOS you are using and on what router. How large is your registration table.
 
rucevzhuru
newbie
Topic Author
Posts: 43
Joined: Fri May 25, 2007 6:57 pm

Re: API bug

Mon May 24, 2010 10:15 pm

what version of RouterOS you are using and on what router. How large is your registration table.
Hi janisk,
we use mostly version 3.10 so that I have observed it only on 3.10. Number of items in registration table varies (from 16 to 45, depends on the router).

First problem is harmless becouse i can detect it but second problem is worse becouse sometimes it creates good formed length number (which is totally incorrect and it makes word length bigger than 127 even though it's smaller or equal than 127).

Thank you
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: API bug

Tue May 25, 2010 10:55 am

there where problems with API replies on older versions, i just do not remember when exactly they where fixed. So definitely upgrade to newer version of RouterOS at least 3.30 that has been there for some time already.

Who is online

Users browsing this forum: No registered users and 10 guests