Community discussions

MikroTik App
 
waver
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 53
Joined: Thu May 02, 2013 2:19 pm

Possible bug on 6.35.2

Thu Jun 02, 2016 6:32 pm

Dear all,

We are working for a new VRRP project and found a "inexplicable" error :?

I have 2 CCR1009-8G-1S-1S+ configured with VRRP, two WAN's, all ok. On a second router we configured a "netwatch" to enable or disable a "PPPoE" interface and this is the problem. The "netwach" works correctly but on different interface.
If i open "new terminal"/ interface / print, the "PPPoE" interface is number 12 but when "netwatch" works (disable/enable) on another interface :shock:
If i disable or enable interface from "New terminal" works fine, the problem is only with "netwatch".


Anyone have idea about this?



Thanks,
 
pe1chl
Forum Guru
Forum Guru
Posts: 10550
Joined: Mon Jun 08, 2015 12:09 pm

Re: Possible bug on 6.35.2

Thu Jun 02, 2016 9:59 pm

Don't use a fixed object number, use a [find] command...
 
waver
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 53
Joined: Thu May 02, 2013 2:19 pm

Re: Possible bug on 6.35.2

Mon Jun 06, 2016 12:08 pm

Yes, i know but i think so it's a bug. It's possible?
 
pe1chl
Forum Guru
Forum Guru
Posts: 10550
Joined: Mon Jun 08, 2015 12:09 pm

Re: Possible bug on 6.35.2

Mon Jun 06, 2016 12:14 pm

I would not dare to modify an object by number because the number can change at any time.
Apparently it bites you. Why don't you use the proper solution shown in many scripting examples?
 
waver
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 53
Joined: Thu May 02, 2013 2:19 pm

Re: Possible bug on 6.35.2

Mon Jun 06, 2016 12:19 pm

Sorry, but i don't say if i works with numbers i only say the "problem" and the question is, this is a "bug"? only.

I work every day with rOS and i know the best practises and proper solutions, this post is only to show a possible bug.



Thanks,
 
User avatar
strods
MikroTik Support
MikroTik Support
Posts: 1661
Joined: Wed Jul 16, 2014 7:22 am
Location: Riga, Latvia

Re: Possible bug on 6.35.2

Mon Jun 06, 2016 2:31 pm

Usually commands does not know id if print function is not executed.
You should try to edit your script like this:
/interface print
/interface and_the_rest_of_your_command
 
pe1chl
Forum Guru
Forum Guru
Posts: 10550
Joined: Mon Jun 08, 2015 12:09 pm

Re: Possible bug on 6.35.2

Mon Jun 06, 2016 4:53 pm

Usually commands does not know id if print function is not executed.
Ok but does it matter?
Why would you ever want to use /interface set 0 xxxx?
Isn't it much better and safer to use /interface set [find name="interfacename"] xxxx ?
When I look in my /interface print output the interface numbers change e.g. when an L2TP user logs in.
I would never ever want to run a background script on a fixed item number...

Maybe one can say that the real bug is that fixed item numbers are allowed from script context....
 
User avatar
strods
MikroTik Support
MikroTik Support
Posts: 1661
Joined: Wed Jul 16, 2014 7:22 am
Location: Riga, Latvia

Re: Possible bug on 6.35.2

Tue Jun 07, 2016 8:30 am

Yes, you should use commands with find function included. I was just describing why it does not work in Netwatch same way as it does in CLI.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8712
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Possible bug on 6.35.2

Tue Jun 07, 2016 11:26 am

Isn't it much better and safer to use /interface set [find name="interfacename"] xxxx ?
also, why not just "/interface set interfacename xxxx"? :D
 
waver
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 53
Joined: Thu May 02, 2013 2:19 pm

Re: Possible bug on 6.35.2

Thu Dec 01, 2016 11:22 am

Isn't it much better and safer to use /interface set [find name="interfacename"] xxxx ?
also, why not just "/interface set interfacename xxxx"? :D

Yes, this is the better solution, and works fine but repeat, this post is only to present a "possible" bug on firmware.


Thanks to all!
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8712
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: Possible bug on 6.35.2

Thu Dec 01, 2016 3:41 pm

it's not a bug because the index depends on previous 'print' command. for example:
[admin@TestPlace] /interface> print where name="ether6"
Flags: D - dynamic, X - disabled, R - running, S - slave 
 #     NAME
 0  RS ether6
[admin@TestPlace] /interface> disable 0
[admin@TestPlace] /interface> print where name="ether7" 
Flags: D - dynamic, X - disabled, R - running, S - slave 
 #     NAME
 0  RS ether7
[admin@TestPlace] /interface> disable 0         
in those cases "disable 0" will disable two different interfaces

so just use "/interface disable pppoe-out1" and "interface enable pppoe-out1" commands in NetWatch scripts

p.s. if you're afraid that someone will rename the interface, you may use this dirty hack:
[admin@TestPlace] /interface> :put [find name=ether6];
*14
[admin@TestPlace] /interface> disable *14
i.e. use internal interface ID instead of name, it's constant between interface renaming :)