Abed_AL-R
Apr 05, 2022Cirrostratus
iRule error - bad IP address format (line x)
I just deployed this irule:
when HTTP_REQUEST {
if { [HTTP::header exists "X-Forwarded-For"] } {
set client_ip [HTTP::header value "X-Forwarded-For"]
set fromCountry [whereis $client_ip country]
if { ( [class match $fromCountry equals Blocked_Countries]) }{
drop
}
}
}
And I'm getting this error in /var/log/ltm:
TCL error: /parition1/BlockedCoun_XFF <HTTP_REQUEST> - bad IP address format (line 2) invoked from within "whereis $client_ip country"
TCL error: /parition1/BlockedCoun_XFF <HTTP_REQUEST> - bad IP address format (line 3) invoked from within "whereis $client_ip country"
I saw this article but not sure enough how to implement it in my irule
https://support.f5.com/csp/article/K15450552
Could you please advise on this?
Thanks