Community discussions

MikroTik App
 
djnewbie
just joined
Topic Author
Posts: 5
Joined: Sat Nov 10, 2018 9:50 am

grabbing ip from packet-mark in queue tree

Fri Nov 05, 2021 9:25 am

grabbing ip from packet-mark in queue tree
fyi packet-mark sample Upaket-192.168.168.17
i've following script, where i missing (i'm noob in scripting -_- )
Mikrotik OSv6.44.2
:foreach cmt in=[/queue tree find max-limit="1000k"] do={
:local split [:tostr [/queue tree get $cmt packet-mark]];
:global ipinv 
:set ipinv [:pick $split 6 [:len $split]];
:if ([/ping $ipinv count=4] = 0) do={
/ip firewall mangle remove [find where comment=("Upaket-"."$ipinv")];
/ip firewall mangle remove [find where comment=("Upload-"."$ipinv")];
/ip firewall mangle remove [find where comment=("Dpaket-"."$ipinv")];
/ip firewall mangle remove [find where comment=("Download-"."$ipinv")];
/queue tree remove [find where packet-mark=("Dpaket-"."$ipinv")];
/queue tree remove [find where packet-mark=("Download-"."$ipinv")];
/queue tree remove [find where packet-mark=("Upaket-"."$ipinv")];
/queue tree remove [find where packet-mark=("Upload-"."$ipinv")];
}}
:else [/tool fetch url="https://api.telegram.org/botyyyy:xxxx/sendMessage\?chat_id=-zzzzz&text=error" mode=http http-method=post keep-result=no;];
 
djnewbie
just joined
Topic Author
Posts: 5
Joined: Sat Nov 10, 2018 9:50 am

Re: grabbing ip from packet-mark in queue tree

Tue Nov 09, 2021 2:07 am

grabbing ip from packet-mark in queue tree
fyi packet-mark sample Upaket-192.168.168.17
i've following script, where i missing (i'm noob in scripting -_- )
Mikrotik OSv6.44.2
:foreach cmt in=[/queue tree find max-limit="1000k"] do={
:local split [:tostr [/queue tree get $cmt packet-mark]];
:global ipinv 
:set ipinv [:pick $split 6 [:len $split]];
:if ([/ping $ipinv count=4] = 0) do={
/ip firewall mangle remove [find where comment=("Upaket-"."$ipinv")];
/ip firewall mangle remove [find where comment=("Upload-"."$ipinv")];
/ip firewall mangle remove [find where comment=("Dpaket-"."$ipinv")];
/ip firewall mangle remove [find where comment=("Download-"."$ipinv")];
/queue tree remove [find where packet-mark=("Dpaket-"."$ipinv")];
/queue tree remove [find where packet-mark=("Download-"."$ipinv")];
/queue tree remove [find where packet-mark=("Upaket-"."$ipinv")];
/queue tree remove [find where packet-mark=("Upload-"."$ipinv")];
}}
:else [/tool fetch url="https://api.telegram.org/botyyyy:xxxx/sendMessage\?chat_id=-zzzzz&text=error" mode=http http-method=post keep-result=no;];
it's solved now, it's objective is deleting leftover rule from hotspot login/logout script in mangle and queue tree,
i do export my persistent mangle rules then scheduled delete non dynamic rules in there and import my backup rules, and for queue tree i did remove the parent queue tree first so the child queue become invalid so add script to remove invalid state queue tree, and then make parent queue again, it's easier that way though :D

Who is online

Users browsing this forum: Google [Bot], techcomtecnico and 36 guests