doug_hays_9832
Aug 17, 2006Nimbostratus
Is This Way Correct?
I am trying to create an Irule that will include our current rate limiting that is working for connections but unfortunately is blocking some proxy caches we want to allow and limit those caches to 500kbps. I have modified the Irule below to allow the proxies through with a different rate limit class of their own in the added If-aol-return section below but the proxies still cannot get through.
Thanks for your help
priority 700
when RULE_INIT {
array set ::active_clients { }
}
when CLIENT_ACCEPTED {
if { [matchclass [IP::remote_addr] equals $::monhosts] } {
return
}
if { [matchclass [IP::remote_addr] equals $::aol] } {
rateclass rate_limit_500kbps} {
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 rate_limit_400kbps
} elseif { $::active_clients($client_ip) > 100 } {
rateclass rate_limit_800kbps
} elseif { $::active_clients($client_ip) > 50 } {
rateclass rate_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)
}
}
}