Forum Discussion
kenhuang_89481
Nimbostratus
Jul 12, 2010about binary format/scan
The following paragraph is about "irules
". It's easy and there's no problem.
look this rules...
when CLIENT_ACCEPTED {
TCP::collect 1
}
when CLIENT_DATA {
if { [TCP::payload 1] equals "0" } {
pool pool0
} elseif {[TCP::payload 1] equals "1"}{
TCP::payload replace 0 1 ""
pool pool1
} else { pool game_pool3 }
TCP::release
}
interpret:
When the client send ASCII '0', IRULES will send this requirement directly to pool0.
When the client send ASCII '1', IRULES will delete the first byte of the package and also send the byte to pool1. So far, all is Ok.
But now in case that the client send the 3 of the binary and also do the matching, VS will send the requirement of the client to pool3 when they match well.
thanks
5 Replies
- hoolio
Cirrostratus
Hi Ken,
Can you clarify what your question is? Have you tried testing this iRule? If so, what results do you see? If you want to get more info on what the iRule is doing, you can add debug logging. See the log wiki page for more info:
http://devcentral.f5.com/wiki/default.aspx/iRules/log
And here are a few links to the commands you have in the iRule
http://devcentral.f5.com/wiki/default.aspx/iRules/tcp__collect
http://devcentral.f5.com/wiki/default.aspx/iRules/tcp__payload
http://devcentral.f5.com/wiki/default.aspx/iRules/tcp__release
Aaron - kenhuang_89481
Nimbostratus
i'm try this problem
new irules is
when CLIENT_ACCEPTED {
}
when CLIENT_DATA {
set payload [TCP::payload]
binary scan c $payload jieguo
if { $jieguo equals "6" } {
TCP::payload replace 0 1 ""
pool test-socket }
TCP::release
}
it's right ,but what i delete the first byte of the package and also send the byte to pool1. - kenhuang_89481
Nimbostratus
TCP::payload replace 0 1 ""
this's wrong ... - hoolio
Cirrostratus
I think you need to call TCP::collect in order to have LTM buffer the TCP payload. Can you elaborate on what exactly you're trying to accomplish and the issue(s) you're seeing with the rule?
Aaron - kenhuang_89481
Nimbostratus
when CLIENT_ACCEPTED {
TCP::collect 1
}
when CLIENT_DATA {
set payload [TCP::payload ]
binary scan c $payload jieguo
if { $jieguo equals "6" } {
TCP::payload replace 0 1 ""
pool test-socket }
TCP::release
}
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