Forum Discussion
ShakeelRashid
Nimbostratus
Mar 05, 2018Non HTTP Traffic Stream Profile
Hi All,
I'm having a weird issue with a very simple stream profile I have attached to a VS. The profile looks for an occurrence of an IP address in the data and replaces it with its own VS IP a...
Stanislas_Piro2
Cumulonimbus
Mar 05, 2018The problem is TNS have header length value you have to update. Try this new version code:
when CLIENT_ACCEPTED {
set collected_length 0
set virtual_ip [IP::local_addr]
}
when SERVER_CONNECTED {
TCP::collect
}
when SERVER_DATA {
set tns_data [TCP::payload]
Detect if the response is a redirect
if {[binary scan $tns_data SSccSSA* packet_length packet_checksum type reserved_byte header_checksum redirect_length redirect_data] == 7 && $type == 5} {
if {[set host_start [string first "(HOST=" $redirect_data]] != -1 && [set host_end [string first ")" $redirect_data $host_start]] != -1} {
set new_redirect_data [string replace $redirect_data $host_start $host_end "(HOST=$virtual_ip)"]
set new_redirect_length [string length $new_redirect_data]
TCP::payload replace 0 [TCP::payload length] [binary format SSccSSA* [expr {$new_redirect_length+10}] $packet_checksum $type $reserved_byte $header_checksum $new_redirect_length $new_redirect_data]
}
}
TCP::release
if {$collected_length < 2048} {
TCP::collect
}
}
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