Forum Discussion
Jereme_De_Leo_4
Nimbostratus
Sep 11, 2006TCL Error
Greetings,
I am receiving the following TCL error in the Local Traffic logs of the Big-IP:
"TCL error: Rule rate_limit_5 CLIENT_CLOSED - cant read client_ip: no such variable while executing info exists ::active_clients$client_ip"
The error refers to the "CLIENT_CLOSED" section of the "rate_limit_5" iRule, on the line "info exists ::active_clients$client_ip". The iRule is listed below.
What I am trying to do is set a rule that limits the amount of bandwidth (kbps) given to a client IP address based on the number of active connections from that client IP. The only exception is when the client IP address matches an IP address in the "monhosts" list, which effectively exempts that IP from the rule.
The rule has passed the iRule Editor check and appears to be working fine, except for the TCL error being received.
Any assistance is greatly appreciated.
---START IRULE RATE_LIMIT_5---
priority 700
when RULE_INIT {
array set ::active_clients { }
}
when CLIENT_ACCEPTED {
if { [matchclass [IP::remote_addr] equals $::monhosts] } {
return
}
set client_ip [IP::remote_addr]
if { [info exists ::active_clients($client_ip)] } {
incr ::active_clients($client_ip)
if { $::active_clients($client_ip) > 250 } {
drop
} elseif { $::active_clients($client_ip) > 150 } {
rateclass limit_400kbps
} elseif { $::active_clients($client_ip) > 100 } {
rateclass limit_800kbps
} elseif { $::active_clients($client_ip) > 50 } {
rateclass limit_1600kbps
}
} else {
set ::active_clients($client_ip) 1
}
}
when CLIENT_CLOSED {
if { [info exists ::active_clients($client_ip)] } {
incr ::active_clients($client_ip) -1
if { $::active_clients($client_ip) <= 0 } {
unset ::active_clients($client_ip)
}
}
}
---END IRULE RATE_LIMIT_5---
Thank you,
jddevcen
- Deb_Allen_18Historic F5 AccountI'd guess that the connections meant to be excluded from the rule are hitting the CLIENT_CLOSED event without having set the variable "client_ip" for those connections.
when CLIENT_ACCEPTED { if { [matchclass [IP::remote_addr] equals $::monhosts] } { event disable all } set client_ip [IP::remote_addr] ...
Hello,
Do you really need this variable ? Isn't it more flexible to use [IP::client_addr] in the CLIENT_CLOSED event ?
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