Forum Discussion

Joe_Hsy_45207's avatar
Joe_Hsy_45207
Icon for Nimbostratus rankNimbostratus
Jan 31, 2008

Call to get the version of TMOS?

 

Hi,

 

 

I've looked on the iRule wiki, but could not find a function which would return the version of TMOS currently running. Is there a way to get this info?

 

 

Thanks!

 

 

//Joe

6 Replies

  • I don't think there is. This might be a good feature request to make through F5 support.

     

     

    Are you trying to use a generic rule for multiple LTM versions? If so, what issue(s) are you finding? There might be workarounds you can use to write a rule which would work for multiple versions.

     

     

    Aaron
  • Hi Aaron,

     

     

    Thanks for the response. Yes, I am trying work around the issue of HTTP::header returning single or multiple. Without knowing the version, the iRule can't tell if there is only one header value or it is simply the last header value.

     

     

    I've also had to work around the [vserver name] not working for all versions of LTM. One nice generic feature would be if there is "meta" function to indicate if a particular call exists.

     

     

    If there isn't some way within iRule itself, I will need to put the code into iControl which modifies the iRule depending on the LTM version.

     

     

    //Joe
  • Hi Joe,

    You can use the catch command (Click here) to handle errors. In effect, you could use this at the beginning of your rule to determine which version of rules your rule is running on at run time. If you know that virtual only works in 9.4+, you could use something like this to confirm the version:

    
    when CLIENT_ACCEPTED {
        The command to test the version with
       set test_cmd virtual
        Execute the command, catching any error.  If there isn't an error, save the output to $output
       if {[catch {$test_cmd} output]}{
           catch returned true, so the command generated an error
          log local0. "test_cmd returned an error"
           track that the rule is 9.4 or higher
          set v9.4 1
       } else {
           catch returned false, so the command was valid
          log local0. "\$output: $output"
           track that the rule is 9.4 or higher
          set v9.4 0
       }
    }

    If there was a command that was valid in the RULE_INIT event that is version-specific, you'd only need to run this check once. Else, you're stuck running the logic for every TCP connection.

    Aaron

  • Hi Aaron,

     

     

    Great suggestion! I actually found another way instead of using "catch" by using the tcl "info command". It seems to work and it only needs to execute once at rule_init:

     

     

    set TMOS94command [info command AUTH::subscribe]

     

    if { $TMOS94command != "" } {

     

    set ::TMOS94 1

     

    } else {

     

    set ::TMOS94 0

     

    }

     

     

    Since AUTH::subscribe is introduced in 9.4, the command does not show up when calling info command below 9.4.

     

     

    Thanks for your help as always!

     

     

    //Joe
  • That's an even better option. Thanks for the tip.

     

     

    If you've already opened a case with F5 support for a feature request, let me know the case number and I'll add a case to it.

     

     

    Thanks,

     

    Aaron
  • Hi Aaron,

     

     

    I hadn't opened a case since the workaround is a perfectly fine solution for what I need. Thanks again!

     

     

    //Joe