Forum Discussion
Mauricio_Cusine
Aug 22, 2007Nimbostratus
Validate IP address with regexp
Hello,
I am trying to check if a IP address is valid in the bigip with regexp (I don't know if anybody know other method).
The regexp is the follow but don't work. Anybody can help me?....
Luke_Lehman
Feb 23, 2011Employee
I'm seeing what looks like the same problem the above poster is seeing. I'm base64 decoding a portion of the URI, and the catch sees an exception with the decoded variable value, but doesn't have an exception from a recently declared string value:
set a 256.256.256.256
set b 192.168.199.156
set c 192.168.199.157
if {[catch {b64decode $query_b64encoded_member_ip} b64decoded_member_ip] == 0 and $b64decoded_member_ip ne ""}{
base64 decoding succeeded
if { $::debug } {log local0. "b64 decoding successful: $b64decoded_member_ip"}
}
log local0. "catch $a => [catch {IP::addr $a mask 255.255.255.255} ]"
log local0. "catch $b64decoded_member_ip => [catch {IP::addr $b64decoded_member_ip mask 255.255.255.255} ]" log local0. "catch $b => [catch {IP::addr $b mask 255.255.255.255} ]"
log local0. "catch $c => [catch {IP::addr $c mask 255.255.255.255} ]"
Logged Output:
Rule gen_iRule : b64 decoding successful: 192.168.130.156
Rule gen_iRule : catch 256.256.256.256 => 1
Rule gen_iRule : catch 192.168.199.156 => 1
Rule gen_iRule : catch 192.168.199.156 => 0
Rule gen_iRule : catch 192.168.199.157 => 0
You can see that the .156 address from the base64 decoded value fails the IP:addr check, whereas the pure string variable $c passes fine.
Curious.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects