Irule Help

Hello everyone,

How can I add additional Country codes and address data groups to the following irule. Let say I want to add another data group called “BRAZIL_IPs” in addition to ALLOWED_IPs_INDIA. Also I want to add brazil in the allowed CC list. Please help.

when CLIENT_ACCEPTED { set CC [whereis [IP::client_addr] country]

if { !([class match [IP::client_addr] equals ALLOWED_IPs_INDIA] or $CC equals “SA” or $CC equals "IN ) } { drop

}

}

can you try something like this?

when CLIENT_ACCEPTED { 
  if { [class match -- [IP::client_addr] equals ALLOWED_IPs_INDIA] } {
     India IP
  } elseif { [class match -- [IP::client_addr] equals BRAZIL_IPs] } {
     Brazil IP
  } else {
    switch [whereis [IP::client_addr] country] {
      SA { 
         SA country
      }
      IN { 
         IN country
      }
      default { 
         somewhere else
        drop
      }
    }
  }
}

New Geolocation Capabilities in v10.1 by Jason Rahm

Geolocation Irule