Forum Discussion

Ethan_Erchinger's avatar
Ethan_Erchinger
Icon for Nimbostratus rankNimbostratus
Mar 10, 2006

Passing arguments or iRule introspection

Hello again,

 

 

Is there a way to pass an argument to an iRule? Such as in a virtual call "rule my_irule 1". Then in my_irule reference argv[1] or such.

 

 

If not, how about being able to determine who called this iRule, like $::Parent or something would be the name of a virtual that called this iRule.

 

 

Any ideas?

 

 

I'd like to reuse an iRule with multiple virtuals, but use different snatpools based on who's calling the iRule. Maybe I should simply base it off of IP::server_addr, which should differ between two different virtuals.

 

 

Thanks,

 

Ethan

1 Reply

  • we currently don't support the ability to call rules from other rules. You can use variables to allow to to move context from one rule to another though. In your case, if you want to know which virtual the rule is run under, you can use the "virtual name" command.

    when HTTP_REQUEST {
      log local0. "Virtual name: [virtual name]"
    }

    -Joe