For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

mgpspr_213832's avatar
mgpspr_213832
Icon for Nimbostratus rankNimbostratus
Aug 07, 2015
Solved

how to match against a list in v11?

I'm basically trying to consolidate the endpoints and move away from data groups. That way, when people modify the iRule, everything is transparent to the editor, they dont have to go in and check ot...
  • VernonWells's avatar
    Aug 07, 2015

    class match works only with datagroups. It does not work with Tcl lists. The drawbacks of not using datagroups include:

    1. class matching runs in O(1) time, so the size of the datagroup does not affect the search performance. This is not true for Tcl lists (though you should get something better than O(n) for large lists if you use a Tcl dictionary);
    2. using Tcl lists generally require "inflating" the lists before the command can operate on it, which consumes CPU and memory;
    3. modifying an iRule requires technicians and engineers to know code, at least to some degree, and the list elements cannot be changed via tmsh or the WebUI.

    Having said that, to search a Tcl list, you can use the lsearch method:

     

    when RULE_INIT {
        set static::endpoints [list /about /cblock]
    }
    
    when HTTP_REQUEST {
        if { [lsearch -glob $static::endpoint "[HTTP::uri]*"] != -1 } {
            pool cms
        }
    }
    

     

    There are other ways, but this is likely the simplest.