Community discussions

MikroTik App
 
Njumaen
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 77
Joined: Wed Feb 24, 2016 8:41 pm
Location: Bielefeld, Germany
Contact:

Feature request: overwrite addresslist entries

Tue Dec 13, 2022 11:26 am

/ip/firewall/address-list/
/ip/firewall/address-list> add list=test address=1.1.1.1
/ip/firewall/address-list> add list=test address=1.1.1.1
failure: already have such entry
This results in stopping the import of some well-known address-lists e.g. for blocking.

Would be great, if a double entry would simply be overwritten, or am I missing something?

Cheers,

Ralf.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11968
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Feature request: overwrite addresslist entries

Tue Dec 13, 2022 12:27 pm

Conceptually it is right that it gives an error if you try to overwrite something that already exists,
practically it would be nice if they added a parameter like
"add ignore-duplicates=[no|yes|replace] address=xxx list=xxx"
no = (default if ignore-duplicates is not specified) actual behaviour
yes = ignore duplicates, do not change anything and do not thow error
replace = pratically remove old static or dynamic entry (comment and other info included) and add the new record.
 
Njumaen
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 77
Joined: Wed Feb 24, 2016 8:41 pm
Location: Bielefeld, Germany
Contact:

Re: Feature request: overwrite addresslist entries

Tue Dec 13, 2022 7:14 pm

Great idea! 👍
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 11383
Joined: Thu Mar 03, 2016 10:23 pm

Re: Feature request: overwrite addresslist entries

Tue Dec 13, 2022 9:18 pm

Until MT Santa delivers command as per suggestion by @rextended, it's possible to use construct like this:
{ :do { /ip firewall address-list add address="1.1.1.1" list="test"} on-error={ } }
 
pe1chl
Forum Guru
Forum Guru
Posts: 10186
Joined: Mon Jun 08, 2015 12:09 pm

Re: Feature request: overwrite addresslist entries

Tue Dec 13, 2022 9:27 pm

More in general, it would be useful if an option was added to /import that makes the import continue on errors that can be recovered.
I.e. runtime errors such as this, but also command keyword errors like /lcd on a router that does not have lcd.
Anything that can be recovered by skipping to the next syntactically correct (sub)command.

This way, it does not have to be added to addresslist handling and can be used in many more situations.
 
msatter
Forum Guru
Forum Guru
Posts: 2897
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: Feature request: overwrite addresslist entries

Tue Dec 13, 2022 9:57 pm

Rename address-list -> import new list -> rename renamed address-list to current address-list -> remove renamed address-list still/only containing the double entries. Très simple.

Bye
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 18961
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Feature request: overwrite addresslist entries

Tue Dec 13, 2022 10:55 pm

I am still waiting for using address lists in Routing Rules.............. a real trick!
Blocking by address lists.......... just drop all at end of chain or get an edge router - https://www.juniper.net/gb/en/products/ ... ewall.html
 
Njumaen
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 77
Joined: Wed Feb 24, 2016 8:41 pm
Location: Bielefeld, Germany
Contact:

Re: Feature request: overwrite addresslist entries

Tue Dec 13, 2022 11:01 pm

Rename address-list -> import new list -> rename renamed address-list to current address-list -> remove renamed address-list still/only containing the double entries.
Does not work for me, supposing I rename address-list by
set list="new-name" [find list="old-name"]
Renaming stops at the first occurence of a double entry with "failure: already have such entry" :(
 
msatter
Forum Guru
Forum Guru
Posts: 2897
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: Feature request: overwrite addresslist entries

Tue Dec 13, 2022 11:19 pm

Rename address-list -> import new list -> rename renamed address-list to current address-list -> remove renamed address-list still/only containing the double entries.
Does not work for me, supposing I rename address-list by
set list="new-name" [find list="old-name"]
Renaming stops at the first occurence of a double entry with "failure: already have such entry" :(
The answer to that was given by mkx just a few postings above this one.
 :do { /ip firewall address-list set list="new-name" [find list="old-name"] } on-error={ } 
This will skip the errors and you will the result after it is ready.

Bye
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11968
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Feature request: overwrite addresslist entries

Tue Dec 13, 2022 11:23 pm

While I hate on-horror-resume-next, there's currently no faster method.
The correct one, first check if the record exists, before inserting it,
is the (slow) consequence that do not exist way, through a parameter, to skip import errors and continue,
for the poor listening that MikroTik give to user requests.
It's not the first time he's been asked, and then one gets tired of asking it all the time...
 
msatter
Forum Guru
Forum Guru
Posts: 2897
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: Feature request: overwrite addresslist entries

Tue Dec 13, 2022 11:36 pm

Nope.

Bye

Who is online

Users browsing this forum: tiernano and 24 guests