Need help,
I’m realizing the creation of a script to block the pppoe clients that are in the address list mk-block ipv4 in ipv6 so I’m stuck in, when the script runs, the error appears in the such item and it does not proceed … could they help me?
/ppp active print;
/ipv6 dhcp-server print;
/ip firewall address-list print;
/ipv6 dhcp-server binding print;
/ipv6 pool used print;
/ipv6 firewall address-list print;
:global cnx;
:global cont;
:set cont 0;
:set cnx [/ppp active print count-only];
:for i from=0 to=$cnx do={
:global block;
:global blockv6;
:global ipv4;
:global ipv6;
:global inter;
:global pppuser;
:set ipv4 [/ppp active get value-name=address number=$cont];
:set pppuser [/ppp active get value-name=name number=$cont];
:if ([/ip address get number=[/ip address find where network=$ipv4] value-name=actual-interface] = "no such item") do={ :set inter [:nothing] } else={ :set inter [/ip address get number=[/ip address find where network=$ipv4] value-name=actual-interface];}
:if ([/ipv6 dhcp-server binding get number=[find where server=$inter] value-name=address] != no such item) do={ :set ipv6 [/ipv6 dhcp-server binding get number=[find where server=$inter] value-name=address] } on-error{};
:if ([/ip firewall address-list get number=[/ip address find where network=$ipv4] value-name=address] = "no such item") do={ :set block [:nothing] } else={ :set block [/ip firewall address-list get number=[find address=$ipv4] value-name=address ];}
:if ([/ipv6 firewall address-list find where address=$ipv6] = [:nothing] ) do={ :set blockv6 [:nothing] } else={ :set blockv6 [/ipv6 firewall address-list get number=[find address=$ipv6] value-name=address ];}
:if ($blockv6 = [:nothing] ) do={ /ipv6 firewall address-list add address=$ipv6 list=mk_bloqueio timeout=00:59:00;} else={ :set blockv6 [:nothing]; :set ipv6 [:nothing];}
:set block [:nothing];
:set ipv4 [:nothing];
:set ipv6 [:nothing];
:set inter [:nothing];
:set pppuser [:nothing];
:set cont ($cont + 1);
}