Once again you have caught a mistake in my code.
You're right that it should be %ip.data = $hget(iptracker,%ip.item)
I can't edit my earlier code, so here's the re-write.. hopefully this has everything correct.
alias purgeip {
var %a = 1, %b = $hget(iptracker,0).item
while %a <= %b {
var %ip.item = $hget(iptracker,%a).item, %ip.data = $hget(iptracker,%ip.item), %c = $numtok(%ip.data,32)
while %c {
var %dns = $gettok(%ip.data,%c,32)
if !$hfind(dns,%dns,0) { %ip.data = $remtok(%ip.data,%dns,1,32) }
dec %c
}
if !%ip.data {
.hdel iptracker %ip.item
}
else {
.hadd -m iptracker %ip.item %ip.data
}
inc %a
}
}As to the loop, counting down, it will run once for each IP address that is stored in the data section of the IPTracker hash table.
eg:
ip.data = 12.45.67.89 45.67.89.45 123.456.789.123 222.222.222.222
loop would count from 4 to 0 then end, with the dec, however, with the inc, it would've counted from 4 to 5 then stopped, since there isn't a 5th item in the data.