Forum Discussion
atomicdog_7107
Mar 24, 2012Nimbostratus
Does anyone know why this wouldn't work?
Hey guys I'm trying to create an iRule to log when a specific source port hits a VS... this is what I've created.
when CLIENT_ACCEPTED {
if {[IP::addr[TCP::client_port] equals "...
hooleylist
Mar 25, 2012Cirrostratus
'invalid command name "IP::addr58751"' was caused by not having a space between IP::addr and [TCP::client_port]. As Richard said, you wouldn't want to use IP::addr for this though as it's used for doing bitwise comparisons of IP addresses/subnets.
'invalid command name "59539"' sounds like you had two sets of square braces around TCP::client_port. [TCP::client_port] would return 59539. [[TCP::client_port]] would try to execute the port number as a command and trigger an error.
There shouldn't be a noticeable performance different between the switch and if examples. If you do use the if, you could make it slightly more exact by doing a numeric comparison instead of a string:
when CLIENT_ACCEPTED {
if { [TCP::client_port] == 49562 } {
log local0.debug "client: [IP::client_addr]:[TCP::client_port]"
}
}
Aaron
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