Forum Discussion
Awkrd1_7470
Jul 22, 2011Nimbostratus
Current connections not dropped when using command:discard
Hello,
I have a simple i-Rule implemented that is not doing what I expect it to do. I would like to discard any current or new connections to the pool (TCP reset) when the pool members <2. What am I missing? Is it possible to send a TCP reset to both client and servers? Do I need to change my event statement?
when CLIENT_ACCEPTED {
Check if the VS's default pool has at least 2 active members
if { [active_members [LB::server pool]] < 2 } {
drop/discard the current connections
discard
}
}
I did turn on logging to verify the new connections are being discarded as I would think they should be, but the existing connections seems to persist and are not disconnected. Any assistance will be appreciated,
Thank you!
- The_BhattmanNimbostratusHi Awkrd1,
- L4L7_53191NimbostratusThe CLIENT_ACCEPTED event fires upon completion of the 3-way handshake, so established connections wouldn't actually fire this event and as you've discovered, you won't get the results you want. You may consider other options to deal with the established connections. A custom EAV with action on service down may be one option, although I bet other folks will have other ideas :)
- Awkrd1_7470NimbostratusThanks Bhattman,
- The_BhattmanNimbostratusAnother suggestion is to use a different event such as SERVER_DATA along with TCP connect. This is really not the ideal way to handle this but it could be used indirectly to detect connections and hopefully drop the connections. This is just a theory of course.
- I would have to run some dumps as I'm not sure what exactly happens at the tcp level with a "discard" within that event.. If it just "discards" the packet.. I would think you'd see a lot of tcp retransmissions from the host if you're not sending any tcp parms to the server/host.. just dropping packets..?
- L4L7_53191NimbostratusI think it's time we ask: what layer 7 protocol are we dealing with here? It may really matter given the use case.
- Awkrd1_7470NimbostratusThank you Matt!
- L4L7_53191NimbostratusThat's why you'd want to use an EAV here - you can create your own logic that determines when the pool is down. It would be easy to fail a custom monitor with a single available member this way.
- Ryan_Paras_7933NimbostratusMost certainly NOT an elegant solution, but I think you could try this kludgy idea, which does not involve an irule....
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