# BIG-IP DNS iRule issue with static variable

**URL:** <https://community.f5.com/t/big-ip-dns-irule-issue-with-static-variable/74436>\
**Category:** Technical Forums\
**Tags:** dns, application-delivery\
**Created:** [April 30, 2024, 2:47am UTC](https://community.f5.com/t/big-ip-dns-irule-issue-with-static-variable/74436 "2024-04-30T02:47:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nabf5guy](https://avatars.discourse-cdn.com/v4/letter/n/53a042/32.png) [@nabf5guy](https://community.f5.com/u/nabf5guy)\
**Post date:** [April 30, 2024, 2:47am UTC](https://community.f5.com/t/big-ip-dns-irule-issue-with-static-variable/74436/1 "2024-04-30T02:47:36Z")

</div>

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:

```auto
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:

```auto
Apr 30 12:06:37 somebigipdns.nope.com 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:

```auto
Apr 30 11:11:27 somebigipdns.nope.com 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

---

<div class="post-metadata">

**Author:** ![nabf5guy](https://avatars.discourse-cdn.com/v4/letter/n/53a042/32.png) [@nabf5guy](https://community.f5.com/u/nabf5guy)\
**Post date:** [April 30, 2024, 6:10am UTC](https://community.f5.com/t/big-ip-dns-irule-issue-with-static-variable/74436/2 "2024-04-30T06:10:13Z")

</div>

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.

```auto
set ::static::some_variable_name

```

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

```auto
$::static::some_variable_name

```

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

---

<div class="post-metadata">

**Author:** ![zamroni777](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/zamroni777/32/1473_2.png) [@zamroni777](https://community.f5.com/u/zamroni777)\
**Post date:** [April 30, 2024, 5:25pm UTC](https://community.f5.com/t/big-ip-dns-irule-issue-with-static-variable/74436/3 "2024-04-30T17:25:50Z")

</div>

adding to @nabf5guy ,

this is the doc link:

> **[static](https://clouddocs.f5.com/api/irules/static.html)**
