Forum Discussion
syntax error in iRule using data group
in LTM V10.2, I am trying to match against a bunch of IPs included in a datagroup and am getting an error. The datagroup config looks good (see below) and when I remove the $::safeiiplist and insert a single IP, it works.
when HTTP_REQUEST { set username [HTTP::cookie username] log local0. "URI is [string tolower [HTTP::uri]]. Username is $username." if {($username contains "\@jones") || ($username contains "\@smith") } { log local0. "Matched username! Username is $username." if { [IP::addr [IP::client_addr] equals $::safeiiplist] } { log local0. "Matched client address: [IP::client_addr]" switch -glob [HTTP::uri] {
ERROR: bad IP network address format invoked from within "IP::addr [IP::client_addr] equals $::safeiiplist"
Datagroup config: class safeiiplist { host 207.140.60.67 }
3 Replies
- Cory_50405
Noctilucent
Instead of this:
if { [IP::addr [IP::client_addr] equals $::safeiiplist] } {Use this:
if { [class match [IP::client_addr] equals safeiiplist] } { - TMcGov_92811
Nimbostratus
Cory, thanks alot this logic works. Maybe its just my OS version, but this is what works for me:
if { [matchclass [IP::client_addr] equals $::safeiiplist] } {
- Cory_50405
Noctilucent
Yes, 'matchclass' is v10. 'class match' is v11. Apologies for not catching that from your original post.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
