Forum Discussion
Mariusz_B
Nimbostratus
Feb 17, 2015iRule - wrong variable definition ?
Hi all,
I have the following iRule, which in terms of syntax is fine:
when DNS_REQUEST {
switch [IP::remote_addr] {
"10.10.1.32/27" -
"10.10.1.64/27" -
"10.10.1.16...
JRahm
Admin
Feb 19, 2015IP::remote_addr will never match those IPs with mask attached, so you should remove the mask if you want that condition to match.
I agree with Brad you should either set a default value for the variable, or use info exists on the variable you've set. Here's a potential solution:
when DNS_REQUEST {
switch [IP::remote_addr] {
"10.10.1.32" -
"10.10.1.64" -
"10.10.1.160" -
"10.10.1.192" {
set status [LB::status vs Client_Monitor_VIP]
}
}
if {[info exists status]} {
if {$status equals "up"} {
host 1.1.1.1
}
} else {
host 2.2.2.2
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
