Forum Discussion
kman_52500
Nimbostratus
Oct 17, 2007irule loggin a class caused all Irules using that clase to fail
Can anyone provide any insight to this problem?
I recently created this rule that logged a class valid_methods
when HTTP_REQUEST {
if { not [matchclass [HTTP::method] equals $::valid_methods] } {
reject
} elseif { [HTTP::uri] contains "cmd.exe" || [HTTP::uri] contains "root.exe" || [HTTP::uri] contains "admin.dll" } {
discard
} elseif { not([HTTP::method] eq \"POST\") } {
set url https://[getfield [HTTP::host] \":\" 1][HTTP::uri]
HTTP::respond 301 \"Location\" \"$url\"
} else {
set log_line \"REDIRECT_POST [IP::remote_addr] [HTTP::host] [HTTP::uri] [HTTP::header Referer]\"
log local0.info \"$log_line [$::valid_methods]\"
}
}
All rules refering to $::valid_methods started failing after I added the line:
log local0.info \"$log_line [$::valid_methods]\"
to this irule
even after removing "[$::valid_methods]" from it, other rules continued to fail with the following error:
Invalid matchclass operands - no class or list type found, lhs: const string, rhs: cmdName (line 5) invoked from within "matchclass [HTTP::method] equals $::valid_methods
The initial error reported by the actual iRule being edited was:
invalid command name "{GET} {HEAD} {OPTIONS} {POST}" while executing "$::valid_methods"
after that the flood of "no class or list type found" messages started rolling in for all iRules refering to $::valid_methods
- Colin_Walker_12Historic F5 AccountWell, just looking at the line
I've got a couple of questions.log local0.info \"$log_line [$::valid_methods]\"
- kman_52500
Nimbostratus
Colin, - hoolio
Cirrostratus
I would guess that somehow the class value in memory was broken somehow with the logging statement using []'s. I would have expected that removing the log line and reloading the config would have fixed the problem though. If you're interested in investigating this more, you could retest it. If you're able to reproduce the problem, you could open a case with F5 support.when HTTP_REQUEST { if { not ([matchclass [HTTP::method] equals $::valid_methods]) } { reject } elseif { [string tolower [HTTP::uri]] contains "cmd.exe" || [string tolower [HTTP::uri]] contains "root.exe" || [string tolower [HTTP::uri]] contains "admin.dll" } { discard } elseif { not ([HTTP::method] eq "POST") } { set url https://[getfield [HTTP::host] ":" 1][HTTP::uri] HTTP::respond 301 "Location" $url } else { log local0.info "REDIRECT_POST [IP::remote_addr] [HTTP::host] [HTTP::uri] [HTTP::header Referer] $::valid_methods" } }
- kman_52500
Nimbostratus
>If you're able to reproduce the problem, you could open a case with F5 support.
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