Forum Discussion
Richard__Harlan
Dec 01, 2011Historic F5 Account
adding iRule
Has anyone got a more complex iRule to add through iApps? WHen trying the the following iRule into a config I get the following errorscript did not successfully complete: (can't read "source_addr": no such variablewhile executing"set irule_buffer "{when CLIENT_ACCEPTED {set source_addr \[IP::client_addr\]set dest_ip_port \[IP::loca..."invoked from within"if { $irule_firewall == $YES_ANSWER } {set irule_firewall_rule $::basic__irule_firewall_ruleset rule [ split $irule_firewall_rule ; ]..." line:83)
when CLIENT_ACCEPTED {/
set source_addr \[IP::client_addr\]/
set dest_ip_port \[IP::local_addr\]:\[TCP::local_port\]/
log local0. \"Source = $source_addr Dest_IP:Port = $dest_ip_port\"/
set dest_addr \[class match -value -- \[IP::client_addr\] equals test\]/
log local0. \"Class info - $dest_addr\"/
if { $dest_addr != $dest_ip_port || $dest_addr equals \"\" } {/
reject/
log local0. \"Rest connection from $source_addr to $dest_ip_port\"/
}/
}/
I have been playing with this for a while and no matter how I escape the iRule the iApp TCL is treating the iRule Tcl not as a variable but as code to run. Any help would be great.
Richard.
- Brent_Blood_768Historic F5 AccountHi Richard,
set code "when CLIENT_ACCEPTED \{\n" append code "set source_addr \[IP::client_addr\]\n" append code "set dest_ip_port \[IP::local_addr\]:\[TCP::local_port\]\n" append code "log local0. \"Source = \$source_addr Dest_IP:Port = \$dest_ip_port\"\n" append code "set dest_addr \[class match -value -- \[IP::client_addr\] equals test\]\n" append code "log local0. \"Class info - \$dest_addr\"\n" append code "if \{ \$dest_addr != \$dest_ip_port || \$dest_addr equals \"\" \} \{\n" append code " reject\n" append code " log local0. \"Rest connection from \$source_addr to \$dest_ip_port\"\n" append code " \}\n" append code "\}" tmsh::create ltm rule rh { $code }
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