Community discussions

MikroTik App
 
User avatar
cFortC
just joined
Topic Author
Posts: 7
Joined: Wed May 31, 2023 12:53 am

What does [ find default=yes ] mean?

Thu Jun 01, 2023 9:26 pm

In some exported configuration scripts posted on the web, I see lines that contain [ find default= <something> ]
I have looked all over for a definition of what it means to put commands like that inside brackets.
The closest I came to an explanation was this script quote from the "Manual:Configuration_Management" manual page:

/interface ethernet
set [ find default-name=ether5 ] auto-negotiation=no name=ether1-gateway
set [ find default-name=ether6 ] name=ether2
set [ find default-name=ether7 ] name=ether3
set [ find default-name=ether8 ] name=ether4
set [ find default-name=ether1 ] name=ether5
set [ find default-name=ether2 ] name=ether6
set [ find default-name=ether3 ] name=ether7
set [ find default-name=ether4 ] name=ether8

The page suggests that the export script command inserted the bracketed commands as a hint that a default has been violated.
However, it is not clear to me if this situation can be ignored or requires fixing up before importing the script.
Can I simply delete the bracketed command and move on, or is additional action required?
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: What does [ find default=yes ] mean?

Fri Jun 02, 2023 11:59 pm

Convert instruction to "language"...

RouterOS, look for the interface that has the default name "ether6" and change its name to "ether2"


Sometimes this "shift" of names depends on:
1) Upgrading from one version of RouterOS to another, where naming conventions change
2) Upgrading from one RouterOS version to another, where the driver loading order changes
3) Upgrade from one version of RouterOS to another, where the name written on the box is no longer taken into account
4) The user's hands
5) Stupidly uploading a backup made on another device
6) Stupidly uploading a backup made on another version

I'm sure I'm forgetting something
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 11381
Joined: Thu Mar 03, 2016 10:23 pm

Re: What does [ find default=yes ] mean?

Sat Jun 03, 2023 11:58 am

In some exported configuration scripts posted on the web, I see lines that contain [ find default= <something> ]

A bit more "down to roots" explanation:

the set command needs a list of items on which properties have to be changed. In particular case value of name property is changed. In usual (interactive) case, either one types in item index number (keeping in mind that index number is not a static thing, it depends on previously executed print command) or set command prompts to enter tge number. Alternative is to use "square bracket" construct which passes zero, one, or many references to items.
The contents of "squate bracket" construct can be various but find command is very handy. Now the find command takes a few options and these are referring to item properties (you can not search items according to non-existant properties). In this particular case find command is searching according to value of property default-name ... physical interfaces have this oroperty, logical interfaces don't. One could as well run something like this:
/interface ethernet
set [ find name="ether2" ] speed=10M 
but in this case command would change setting of interface which has that name at time of executing the command.


So basically: the default-* is nothing really special, some items gave such properties, most don't.

Who is online

Users browsing this forum: GoogleOther [Bot], loloski, Netstumble, patrikg and 45 guests