Another Bug in 4.9

I regret having upgraded a bunch of APs to 4.9 from 4.4 early this morning. I’d tested with one AP and things appeared okay. Until I enabled a Ruby script that I run that auto-configures the APs from a database using the RouterOS API.

Apparently between 4.4 and 4.9, the results of the API call /interface/wireless/getall have changed. No longer are ALL (“getall” really should get ALL) settings returned in the API reply, but a very limited subset only. So my Ruby script got confused, not seeing a bunch of settings, and would try to fix it by updating things.

Any time you update settings on a Mikrotik wireless interface, all associated clients will drop as the interface cycles, even if technically no change to the setting was made (just the fact that via the API you tried to set it I assume must trigger a reset).

Needless to say, this was not good for my clients.

PLEASE PLEASE PLEASE, MikroTik, when you update to new versions, ALERT US in the CHANGELOG to ANY/ALL API changes!!!

Please, please, please, MikroTik, make sure that your ‘getall’ API commands ALWAYS return ALL settings. Please!

Thank you!

Here’s an example doing API command “/interface/wireless/getall ?name=wlan1” under RouterOS 4.4:

<<< ‘/interface/wireless/getall’ (26)
<<< ‘?name=wlan1’ (11)
<<< ‘.tag=2’ (6)
<<< END-OF-SENTENCE

‘!re’ (3)
‘.id=*3’ (6)
‘name=wlan1’ (10)
‘mtu=2290’ (8)
‘l2mtu=2290’ (10)
‘mac-address=AA:BB:CC:DD:EE:FF’ (29)
‘arp=enabled’ (11)
‘disable-running-check=false’ (27)
‘interface-type=Atheros AR5413’ (29)
‘radio-name=TestRadio’ (23)
‘mode=ap-bridge’ (14)
‘ssid=TestRadioSSID’ (18)
‘area=’ (5)
‘frequency-mode=manual-txpower’ (29)
‘country=united states’ (21)
‘antenna-gain=0’ (14)
‘frequency=5180’ (14)
‘band=5ghz-10mhz’ (15)
‘scan-list=default’ (17)
‘rate-set=default’ (16)
‘supported-rates-b=1Mbps,2Mbps,5.5Mbps,11Mbps’ (44)
‘supported-rates-a/g=6Mbps,9Mbps,12Mbps,18Mbps,24Mbps,36Mbps,48Mbps,54Mbps’ (73)
‘basic-rates-b=1Mbps’ (19)
‘basic-rates-a/g=6Mbps’ (21)
‘max-station-count=2007’ (22)
‘ack-timeout=dynamic’ (19)
‘tx-power-mode=default’ (21)
‘periodic-calibration=default’ (28)
‘periodic-calibration-interval=60’ (32)
‘dfs-mode=none’ (13)
‘wds-mode=dynamic’ (16)
‘wds-default-bridge=bridge1’ (26)
‘wds-default-cost=100’ (20)
‘wds-cost-range=50,150’ (21)
‘wds-ignore-ssid=false’ (21)
‘update-stats-interval=disabled’ (30)
‘default-authentication=false’ (28)
‘default-forwarding=false’ (24)
‘default-ap-tx-limit=0’ (21)
‘default-client-tx-limit=0’ (25)
‘proprietary-extensions=post-2.9.25’ (34)
‘wmm-support=disabled’ (20)
‘hide-ssid=true’ (14)
‘security-profile=supersecureprofile’ (35)
‘disconnect-timeout=00:00:03’ (27)
‘on-fail-retry-time=00:00:00.100’ (31)
‘preamble-mode=both’ (18)
‘compression=false’ (17)
‘allow-sharedkey=false’ (21)
‘station-bridge-clone-mac=00:00:00:00:00:00’ (42)
‘ht-ampdu-priorities=0’ (21)
‘ht-guard-interval=any’ (21)
‘ht-extension-channel=disabled’ (29)
‘ht-supported-mcs=mcs-0,mcs-1,mcs-2,mcs-3,mcs-4,mcs-5,mcs-6,mcs-7,mcs-8,mcs-9,mcs-10,mcs-11,mcs-12,mcs-13,mcs-14,mcs-15’ (118)
‘ht-basic-mcs=mcs-0,mcs-1,mcs-2,mcs-3,mcs-4,mcs-5,mcs-6,mcs-7’ (60)
‘ht-txchains=0’ (13)
‘ht-rxchains=0’ (13)
‘ht-amsdu-limit=8192’ (19)
‘ht-amsdu-threshold=8192’ (23)
‘hw-retries=15’ (13)
‘frame-lifetime=0’ (16)
‘adaptive-noise-immunity=ap-and-client-mode’ (42)
‘hw-fragmentation-threshold=0’ (28)
‘hw-protection-mode=none’ (23)
‘hw-protection-threshold=0’ (25)
‘running=true’ (12)
‘disabled=false’ (14)
‘comment=’ (8)
‘.tag=2’ (6)
END-OF SENTENCE

Now here’s the same command’s API output under 4.10 (which is the same as under 4.9):

<<< ‘/interface/wireless/getall’ (26)
<<< ‘?name=wlan1’ (11)
<<< ‘.tag=2’ (6)
<<< END-OF-SENTENCE

‘!re’ (3)
‘.id=*2’ (6)
‘name=wlan1’ (10)
‘mtu=2290’ (8)
‘l2mtu=2290’ (10)
‘mac-address=00:11:22:33:44:55’ (29)
‘arp=enabled’ (11)
‘interface-type=Atheros AR5413’ (29)
‘mode=ap-bridge’ (14)
‘ssid=TestRadioSSID’ (18)
‘frequency=5180’ (14)
‘band=5ghz-10mhz’ (15)
‘scan-list=default’ (17)
‘antenna-mode=ant-a’ (18)
‘wds-mode=dynamic’ (16)
‘wds-default-bridge=bridge1’ (26)
‘wds-ignore-ssid=false’ (21)
‘default-authentication=false’ (28)
‘default-forwarding=false’ (24)
‘default-ap-tx-limit=0’ (21)
‘default-client-tx-limit=0’ (25)
‘hide-ssid=true’ (14)
‘security-profile=supersecureprofile’ (35)
‘compression=false’ (17)
‘running=true’ (12)
‘disabled=false’ (14)
‘comment=’ (8)
‘.tag=2’ (6)
END-OF SENTENCE

Notice how many more of ALL settings “getall” returns?

sigh Please, MikroTik, please make sure “getall” returns ALL parameters. Please?

Aaron out.

please write to support@mikrotik.com

for wireless use

/interface/wireless/print
=advanced=

to retrieve all the values.

It is was brought in line with CLI by accident and you have to use same constructs as in CLI to retrieve more or less field values. Also, try to use print, since starting form some 3.x versions it is synonym to print command, and eventually you are calling same command.

It appears I am having a similar problem with using a php API on 4.10.

I just need to change a password and this is my code:

<?php

require('routeros_api.class.php');

$API = new routeros_api();

$API->debug = false;
$myusername = $_POST["myusername"];
$mypassword = $_POST["mypassword"];
$guestpassword = $_POST["guestpassword"];
$cmmnd ="=password=";
$cmmnd .=$guestpassword;
$ipofsvr1="111.111.111.112";


if ($API->connect($ipofsvr1, $myusername, $mypassword)) {

	echo "Password Changed Successfully Site1!<br>";

	$API->write('/ip/hotspot/user/print',false);
	$API->write('?name=rvguest');
	$API->write('/ip/hotspot/user/set',false);
	$API->write('=.id=*2',false);
	$API->write($cmmnd);

	$READ = $API->read(false);
	$ARRAY = $API->parse_response($READ);
	
	$API->disconnect();

}
else 
{
  echo "Incorrect Username or Password! Please try again!<br><br>";
  $API->disconnect();
} 

?>

I think the problem is with my getall as well but I do not know what to have here. Please advise.

 $API->write('/ip/hotspot/user/getall',false);
   $API->write('=.proplist=name',false);

Thanks.


-Sincerely,
DesertAdmin

WTF?.. =.id=CONSTANT?.. why don’t you use the result from previous request?

p.s. BTW, you may use directly

	$API->write('/ip/hotspot/user/set',false);
	$API->write('=.id=rvguest',false);

I did not know that was possible. Thanks for your advice I will give it a try as soon as I get some time and let you know if t worked or not thanks.

-Sincerely,
DesertAdmin

Awesome it worked and it is more efficient thanks for you help.

-Sincerely,
DesertAdmin

glad to hear that =)

p.s. Karrrrma %)

Karma’d up for sure thanks again!

-Sincerely,
DesertAdmin