I have a script that adds filter rules. The rules are the sort that need to precede others, so I have "place- before=0" in the script. Mostly, that doesn't work. It fails with this message: the item referred by 'place-before' does not exist (11) This is demonstrably untrue. There are plenty of rules. It *seems* that if I manually print a rule listing before running my script, this error doesn't happen. That's not a useful solution... Stumped. Ideas? Regards, K. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Karl Auer (kauer@nullarbor.com.au) work +61 2 64957435 http://www.nullarbor.com.au mobile +61 428 957160 GPG fingerprint: 6D59 8AE6 810D 44E3 7626 7040 4DD6 F89F 3053 4774 Old fingerprint: 9DCA 0903 BCBD 0647 BCCC 2FA7 A35C 57A1 ACF9 00BB
Hi Karl, The numbering is handled by the system, and is only created when the rules are printed. In a non-interactive environment, the numbers don't exist. A workaround in this case is to use the find command to set the position. For example, something like "place-before=[find comment="Top of List"]" Regards, Ben -----Original Message----- From: Public [mailto:public-bounces@talk.mikrotik.com.au] On Behalf Of Karl Auer Sent: Monday, 5 December 2016 19:02 To: MikroTik Public <public@talk.mikrotik.com.au> Subject: [MT-AU Public] positioning filter rules I have a script that adds filter rules. The rules are the sort that need to precede others, so I have "place- before=0" in the script. Mostly, that doesn't work. It fails with this message: the item referred by 'place-before' does not exist (11) This is demonstrably untrue. There are plenty of rules. It *seems* that if I manually print a rule listing before running my script, this error doesn't happen. That's not a useful solution... Stumped. Ideas? Regards, K. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Karl Auer (kauer@nullarbor.com.au) work +61 2 64957435 http://www.nullarbor.com.au mobile +61 428 957160 GPG fingerprint: 6D59 8AE6 810D 44E3 7626 7040 4DD6 F89F 3053 4774 Old fingerprint: 9DCA 0903 BCBD 0647 BCCC 2FA7 A35C 57A1 ACF9 00BB _______________________________________________ Public mailing list Public@talk.mikrotik.com.au http://talk.mikrotik.com.au/mailman/listinfo/public_talk.mikrotik.com.au
On Mon, 2016-12-05 at 22:27 +0000, Ben Farmer wrote:
The numbering is handled by the system, and is only created when the rules are printed. In a non-interactive environment, the numbers don't exist.
A workaround in this case is to use the find command to set the position. For example, something like "place-before=[find comment="Top of List"]"
Thanks for that succinct description of the situation. I found this as (better? more general?) solution than having to set up a comment or other known target: place-before=[:pick [find] 0] The [find] basically generates a list of all elements, which :pick then takes the zeroth element of. If you know what element you want, you can obviously use values other than zero. Regards, K. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Karl Auer (kauer@nullarbor.com.au) work +61 2 64957435 http://www.nullarbor.com.au mobile +61 428 957160 GPG fingerprint: 6D59 8AE6 810D 44E3 7626 7040 4DD6 F89F 3053 4774 Old fingerprint: 9DCA 0903 BCBD 0647 BCCC 2FA7 A35C 57A1 ACF9 00BB
participants (2)
-
Ben Farmer
-
Karl Auer