Forum Discussion
iRule error - bad IP address format (line x)
Here X-Forwarded-For Value is coming in String and you are changing to IP:Addr that the reason getting error.
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"
Below iRule has not tested but try it
when HTTP_REQUEST {
if { [HTTP::header exists "X-Forwarded-For"] } {
set client_ip [HTTP::header insert X-Forwarded-For]
log local0. "$client_ip"
set fromCountry [whereis $client_ip country]
if { ( [class match $fromCountry equals Blocked_Countries]) }{
drop
}
}
}
Hi Samir
The irule I used is mentioned here, and I just copied it
https://support.f5.com/csp/article/K43383890
it is working fine, but only sometimes it is droping this error.
I will try your solution and update you
Update#2 : I tried your irule, it is droping the error I mentioned all the time. So it did not solve the issue.
Update#3 : I also tried the ASKF5 team recommendation:
set fromCountry [whereis [IP::addr $client_ip mask "255.255.255.255"] country]
But it did not work out. error still showup sometimes in CLI
TCL error: /parition/irule_XFF <HTTP_REQUEST> - bad IP address format (line 1) invoked from within "IP::addr $client_ip mask "255.255.255.255""
I will try to contact F5 support to check if they can help with this.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com