Forum Discussion

nabf5guy's avatar
Icon for Nimbostratus rankNimbostratus
Apr 30, 2024

BIG-IP DNS iRule issue with static variable

I am trying to develop an iRule bypassing DNS processing when a DNS request matching a wide ip comes via a specific listener on our BIG-IP DNS. Code is below:

when RULE_INIT {
    set static::ul_ip "10.X.Y.Z"
    set static::ul_debug true

when DNS_REQUEST priority 100 {
    if { [IP::addr [IP::local_addr]/32 equals $static::ul_ip]} {

        DNS::disable all
        #apparently event disable is no longer accepted?
        #event disable

        if { [$static::ul_debug]} {
            log local0. "DNS Request [DNS::question name] triggered bypass"

This rule is meant to be applied to specific wide ip's (for reasons).

When this rule is applied and tested, I am seeing the message below in /var/log/gtm:

Apr 30 12:06:37 err slot1 tmm[18454]: 011a7001:3: TCL error: Rule /Common/ul-bypass-rule <DNS_REQUEST> - can't read "static::ul_ip": no such variable     while executing "IP::addr [IP::local_addr]/32 equals $static::ul_ip"


I'm completely unclear on why the TCL error is occurring.

For bonus points, any idea why 'event disable' isn't working in the DNS_REQUEST event? This message shows up in /var/log/ltm unless 'event disable' is commented out:

Apr 30 11:11:27 err slot1 mcpd[6981]: 01070151:3: Rule [/Common/ul-bypass-rule] error: /Common/ul-bypass-rule:23: error: [undefined procedure: event][event disable]

Thanks in advance for any assistance provided.

- R

3 Replies

  •  The BIG-IP DNS iRule issue with static variables may arise due to various reasons, including incorrect syntax, scope-related problems,  dish network support numbers, or conflicts with other iRules. Ensure proper declaration and usage of static variables within the iRule code. Debugging techniques such as logging and troubleshooting tools can help identify and resolve issues. Consult F5 documentation, community forums, or support resources for specific guidance on troubleshooting and resolving iRule issues.    

  • Okay, figured out the issue with the static variable.

    If your iRule is a GTM iRule, not an LTM iRule, you need to declare static variables in a fully qualified manner, e.g. 

    set ::static::some_variable_name

    and then call them in a fully qualified manner, .e.g 


    It pays to go back and re-read even the documentation that you think you are familiar with.