Forum Discussion
wenhu_Tang_7610
Nimbostratus
Jul 26, 2005iRules for TCP break up
Hi,
I want to write an iRules to route a TCP packet according to the payload of the packet, but I fail, could you tell whether it is possible and how to achive?
my iRules:
whe...
david_wang_2073
Aug 02, 2005Historic F5 Account
I used following rule to break a tcp connection, it seems work for synchronization model, which means that the traffic should following the sequence of "request->response->request->response". For each connection, the total transcation time can be been reduced by this way.
when CLIENT_ACCEPTED {
set command_length 0
set oper_code 0
set status 0
TCP::collect
}
when CLIENT_DATA {
if {([TCP::payload length] >= 38)}
{
binary scan [TCP::payload 16] Ia8a4 command_length oper_code status
log local. "client data: length $command_length, oper_code $oper_code, status $status"
TCP::release command_length
} else {
log local0. "request lenght less than 38"
}
}
when SERVER_CONNECTED {
TCP::collect
}
when SERVER_DATA
{
if {([TCP::payload length] >= 38)}
{
scan [TCP::payload 4] %d command_length
binary scan [TCP::payload 16] @4a8a4 oper_code status
log local. "server [IP::remote_addr] data: length $command_length, oper_code $oper_code, status $status"
TCP::release command_length
if { $oper_code contains "08020101" } {
binding
log local0. "after first binding"
} else {
TCP::notify resonse
}
} else {
log local0. "request lenght less than 38"
}
}
when USER_RESPONSE {
log local0. "server detach"
LB::detach
}
}It was expected bigip can support asynchronous model, which means that the client can send a batch of request, bigip load balance them to servers before all the responses of server was complected, so the servers can handle the requests from the same client parallen.
In order to do this, I changed the rule to below,
when CLIENT_ACCEPTED {
set command_length 0
set oper_code 0
set status 0
TCP::collect
}
when CLIENT_DATA {
if {([TCP::payload length] >= 38)}
{
binary scan [TCP::payload 16] Ia8a4 command_length oper_code status
log local. "client data: length $command_length, oper_code $oper_code, status $status"
TCP::release command_length
if { $oper_code contains "08010101" } {
#"08020101"为服务器对binding的第一次请求的代码“
log local0. "after first binding"
} else {
TCP::notify request
}
} else {
log local0. "request lenght less than 38"
}
}
when SERVER_CONNECTED {
TCP::collect
}
when SERVER_DATA
{
if {([TCP::payload length] >= 38)}
{
binary scan [TCP::payload 16] Ia8a4 command_length oper_code status
log local. "server [IP::remote_addr] data: length $command_length, oper_code $oper_code, status $status"
TCP::release command_length
} else {
log local0. "request lenght less than 38"
}
}
when USER_REQUEST {
log local0. "server detach"
LB::detach
}
}The testing result is that, bigip can load balance of a batch of requests from client, and in oneconnect model, the server can send the response to bigip even after bigip detached the server. The only problem is that the bigip can not return the data received from detached server to the client.
I am not sure whether it is due to my wrong irule, or it is the limitation of bigip.
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
