Forum Discussion
souravkayal_287
Nimbostratus
Aug 01, 2017Help for irule
set myIpH [format %08x $myIpE] set myIpD1 [expr 0x[substr $myIpH 6 2]] set myIpD2 [expr 0x[substr $myIpH 4 2]] set myIpD3 [expr 0x[substr $myIpH 2 2]] set myIpD4 [expr 0x[substr $myIpH 0 2]] set myIpD "$myIpD1.$myIpD2.$myIpD3.$myIpD4" log local0. "Server Ip address = $myIpD" node $myIpD 4244 unset myIpE unset myIpH unset myIpD1 unset myIpD2 unset myIpD3 unset myIpD4 unset myIpD unset unused
Want to know what does this mean and do. Sorry i am very new to irules.
1 Reply
- cjunior
Nacreous
Hi,
This script part is within a context, so I will not alter or suggest any content here.
This way, I think this code snippet is related to a cookie persistence. See:
https://support.f5.com/csp/article/K6917So, I think this propose to do the following:
Given a cookie value: 1677787402.36895.0000 Catch IP address block myIpE: 1677787402 Convert value to Hex set myIpH [format %08x $myIpE] Result: 6401010a Catch Ip address octets set myIpD1 [expr 0x[substr $myIpH 6 2]] Result: 0x0a => 10 set myIpD2 [expr 0x[substr $myIpH 4 2]] Result: 0x01 => 1 set myIpD3 [expr 0x[substr $myIpH 2 2]] Result: 0x01 -> 1 set myIpD4 [expr 0x[substr $myIpH 0 2]] Result: 0x64 => 100 Concat to give the server IP address set myIpD "$myIpD1.$myIpD2.$myIpD3.$myIpD4" Result: 10.1.1.100 Write a log on the /var/log/ltm log local0. "Server Ip address = $myIpD" Result: Server Ip address = 10.1.1.100 Select node and port 10.1.1.100:4244 node $myIpD 4244 Dispose variables unset myIpE unset myIpH unset myIpD1 unset myIpD2 unset myIpD3 unset myIpD4 unset myIpD unset unusedI hope it helps.
Regards.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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