Forum Discussion
LillyM_9417
Dec 14, 2011Altostratus
switch & swith -globe question
Hello,
I could not manage to work this irule. Please help me to make it run.
Thanks
Lilly
=============================
**************
...
Michael_Yates
Dec 14, 2011Nimbostratus
Hi LillyM,
You cannot switch an IP::addr command the way that you were doing it. See this conversation switch statement, [IP::addr], and varying subnet masks.
The class command (class match $trx1), works with Data Groups. The $trx1, is the variable set in your binary scan. So you can switch off of it, but not perform a class match against it.
Try something like this and let us know if it works for you:
when CLIENT_DATA {
set pay1 [TCP::payload 8]
binary scan $pay1 IA4 len1 trx1
if { [IP::addr [IP::client_addr] equals "x.x.x.x/24" ] } {
switch -glob [ $trx1 ] {
"A" { do something }
"B" { do something }
"C" { do something }
default { do something else }
}
}
elseif { [IP::addr [IP::client_addr] equals "y.y.y.y/24" ] } {
switch -glob [ $trx1 ] {
"D" { do something }
"E" { do something }
"F" { do something }
default { do something else }
}
}
}
Hope this helps!
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