-----
when CLIENT_ACCEPTED {
set ptr [RESOLV::lookup @ inet -ptr [IP::client_addr]]
if { $ptr ends_with ".jp" } {
pool SMTP_AUTH_Pool
log local0. "selected SMTP_AUTH_Pool ptr = $ptr"
} else {
pool SMTP_Fallback_Pool
log local0. "selected SMTP_Fallback_Pool ptr = $ptr"
}
}
-----
but $ptr was empty although I tried with IP address which should be reverse lookuped.
There is a known issue "sol12378: The ‘RESOLV::lookup -ptr’ iRule command fails to return a valid hostname ", so I think is does not work. (Our BIG-IP version is 10.2.1 297.0)
Is there a way to use NAME:: method instead of RESOLV:: method ?
Apr 16 14:44:18 local/tmm err tmm[5276]: 01220001:3: TCL error: dns_reverse_lookup_test - Address in use (line 1) invoked from within “pool SMTP_AUTH_Pool”
i understand since NAME::lookup does not suspend irule processing, NAME_RESOLVED will be triggered after SERVER_CONNECT. so, address in use tcl error will be returned.
i think the better way is to apply the hotfix (in case 10.2.1) or upgrade to not-affected version and use RESOLV::lookup.
when CLIENT_ACCEPTED {
NAME::lookup @DNS_SERVER_IP [IP::client_addr]
node 172.17.20.104:8080 down node
}
when NAME_RESOLVED {
set ptr [string tolower [NAME::response]]
log local0. "[IP::client_addr]:[TCP::client_port]: Lookup result: $ptr"
if { $ptr ends_with ".jp" } {
set pool_name SMTP_AUTH_Pool
} else {
set pool_name SMTP_Fallback_Pool
}
}
when LB_FAILED {
log local0. "LB_FAILED triggered."
LB::reselect pool $pool_name
}
when SERVER_CONNECTED {
log local0. "SERVER_CONNECTED triggered. Pool is $pool_name."
}
It worked!! but sometime it failed, and logged below.
Apr 17 09:00:05 local/tmm1 err tmm1[5277]: 01220001:3: TCL error: dns_reverse_lookup_test - can't read "pool_name": no such variable while executing "LB::reselect pool $pool_name"
I think it is due to the timing of processing NAME_RESOLVED and LB_FAILED. If NAME_RESOLVED is processed earlier than LB_FAILED, it succeeds, but if NAME_RESOLVED is processed after than LB_FAILED, it fails.
I think it seems that our BIGIP should be upgraded to non-affected version to use RESOLV::lookup.
I think it is due to the timing of processing NAME_RESOLVED and LB_FAILED. If NAME_RESOLVED is processed earlier than LB_FAILED, it succeeds, but if NAME_RESOLVED is processed after than LB_FAILED, it fails.
yes, i think so. in case of http, we can hold irule processing using HTTP::collect.
I think it seems that our BIGIP should be upgraded to non-affected version to use RESOLV::lookup.