Forum Discussion
Kevin_Jones_505
Oct 26, 2004Historic F5 Account
TCP::payload - How do I get data from the TCP data field?
I'm trying to write an iRule that reads the TCP data rather than HTTP data. I'm building it off an HTTP data iRule that works. The first one works as expected.
when HTTP_REQUEST {
if {[findstr [HTTP::uri] "user=" 5] == "me" } {
pool pool1
}
else {
pool pool2
}
}
The second doesn't seem to get any data; the TCP::payload seems to be a null.
when CLIENT_ACCEPTED {
if {[TCP::local_port] == 80} {
TCP::collect 75
log local0. "Test1[findstr [TCP::payload] "user=" 5]End"
}
}
when CLIENT_DATA {
if {[findstr [TCP::payload] "user=" 5] == "me"} {
pool pool1
}
else {
pool pool2
}
}
When I run this, the ltm log shows .. Test1End, infering the TCP::payload is null. I've tried many other combinations, but no luck so far. Any advice?
thanks ...
- You are very close. Let's take a look at your code piece by piece...
when CLIENT_ACCEPTED { if {[TCP::local_port] == 80} { TCP::collect 75 log local0. "Text1[findstr [TCP::payload] "user=" 5]End" } }
when CLIENT_DATA { log local0. "Text1[findstr [TCP::payload] "user=" 5]End" if {[findstr [TCP::payload] "user=" 5] == "me"} { pool pool1 } else { pool pool2 } }
- unRuleY_95363Historic F5 AccountIt needs to be pointed out that there is currently a known issue in v9.0.1 (CR41716) that will prevent making a load-balancing decision in the CLIENT_DATA event from working correctly.
- wmazanek_98800
Nimbostratus
Hello, - Geoff_33652
Nimbostratus
I was able to get the above example working with a TCP, but also ran into the same issue as described by wmazanek. Is the LB selection possible with an iRule on a SSL_TCP virtual server? - spark_86682Historic F5 AccountThere's no direct way yet (it's coming, though), so the best you can do is an indirect way. If you're on v9.4.0 or above, you can use the virtual command to direct the decrypted traffic to a standard TCP virtual server where you can then use the usual TCP:: commands to inspect content and make load-balancing decisions. To elaborate, the virtual server that the client connects to will have a clientssl profile, and a very simple iRule that looks like:
when CLIENT_ACCEPTED { virtual internal_virtual }
when CLIENT_ACCEPTED { TCP::collect 100 } when CLIENT_DATA { set payload [TCP::payload] if { $payload contains "magic" } { pool magic_pool } else { pool default_pool } }
- Steve_84041
Nimbostratus
Hi Spark, - hoolio
Cirrostratus
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