Forum Discussion

TMcGov_92811's avatar
TMcGov_92811
Icon for Nimbostratus rankNimbostratus
Jun 17, 2014

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

  • Instead of this:

    if { [IP::addr [IP::client_addr] equals $::safeiiplist] } {
    

    Use this:

    if { [class match [IP::client_addr] equals safeiiplist] } {
    
  • 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's avatar
      Cory_50405
      Icon for Noctilucent rankNoctilucent
      Yes, 'matchclass' is v10. 'class match' is v11. Apologies for not catching that from your original post.