Community discussions

MikroTik App
 
User avatar
tplecko
Member Candidate
Member Candidate
Topic Author
Posts: 120
Joined: Mon Jun 11, 2007 12:18 pm
Location: Croatia
Contact:

unclear about why this happens

Mon Oct 29, 2012 3:54 pm

This is part of the script
:local RemoteIP [ :resolve "my.dynamichostname.com" ]
:for i from=( [:len $RemoteIP] - 1) to=0 do={
:if ( [:pick $RemoteIP $i] = "/") do={
:local RemoteIP [:pick $RemoteIP 0 $i]
}
}

:put $adslip
:for i from=( [:len $adslip] - 1) to=0 do={
:if ( [ :pick $adslip $i ] = "/") do={
:put [ :pick $adslip 0 $i ]
:local adslip [ :pick $adslip 0 $i ]
:put $adslip
}
}
:put $adslip



First loop succesfully strips '/32' from the IP, but the second results with
93.141.38.143/32
93.141.38.143
255.255.255.2
93.141.38.143/32


Does anyone see the error?
 
User avatar
tplecko
Member Candidate
Member Candidate
Topic Author
Posts: 120
Joined: Mon Jun 11, 2007 12:18 pm
Location: Croatia
Contact:

Re: unclear about why this happens

Wed Oct 31, 2012 10:30 am

Anyone?

I changed the script to:

:local RemoteIP [ :resolve "my.dynamichostname.com" ]
:for i from=( [:len $RemoteIP] - 1) to=0 do={
:if ( [:pick $RemoteIP $i] = "/") do={
:local RemoteIP [:pick $RemoteIP 0 $i]
}
}

:local LocalIP [ :resolve "my.otherdynamichostname.com" ]
:for i from=( [:len $LocalIP] - 1) to=0 do={
:if ( [:pick $LocalIP $i] = "/") do={
:local LocalIP [:pick $LocalIP 0 $i]
}
}

/system logging action set remote=$RemoteIP src-address=$LocalIP [ find name="remoteZ15" ]

And now it works as it should. Does anyone know why this happens?

Who is online

Users browsing this forum: McSee and 3 guests