Forum Discussion
Asif_Thobhani_7
Nimbostratus
Jun 03, 2006F5 Cookie encoding
Hi,
Is there a method or an easy way in iRule to encode the IP:Port that is compatible with F5.
From BigIP documentation:
--------------------------
Alternatively, y...
Asif_Thobhani_7
Nimbostratus
Jun 05, 2006After some trial and error, I got the following and it seems to be working...
I will appreciate any comments/corrections!
$nodePort is in format: XXXX
$nodeIP is in format: XXX.XXX.XXX.XXX
Encode the Port for F5
set a $nodePort
set b [expr {[expr {($a) & 0xff00}] >> 8}]
set c [expr {[expr {($a) & 0x00ff}] << 8}]
set encodedPort [expr {$b+$c}]
if { $::DebugFlag } {log LOCAL0. "nodePort: $a, b: $b, c: $c, encodedPort: $encodedPort" }
Encode the IP for F5
set ip [split $nodeIP "."]
set a [getfield $ip " " 1]
set b [getfield $ip " " 2]
set c [getfield $ip " " 3]
set d [getfield $ip " " 4]
set b1 [expr {$b << 8}]
set c1 [expr {$c << 12}]
set d1 [expr {$d << 24}]
if { $::DebugFlag } {log LOCAL0. "a: $a, b1: $b1, c1: $c1, d1: $d1"}
set encodedIP [expr {$a + [expr {$b << 8}] + [expr {$c << 16}] + [expr {$d << 24}]}]
if { $::DebugFlag } {log LOCAL0. "nodeIP: $nodeIP, a: $a, b: $b, c: $c, d: $d, and encodedIP=$encodedIP" }
set encodedIPPort "$encodedIP.$encodedPort.0000"
if { $::DebugFlag } {log LOCAL0. "F5 encodedIP and Port: $encodedIPPort"}
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
