Forum Discussion
breizho35_11667
Nimbostratus
Feb 08, 2010How to read source IP and write http header ?
Hello,
since commencing in iRules, I seek your help to write a script to meet this need:
How to read source IP and write http header ?
when HTTP_Request ( ...
hoolio
Cirrostratus
Feb 08, 2010I think the poster is trying to convert the client IP to a decimal value, along the lines of the PHP ip2long function. I was playing around with such a conversion in TCL, but it seems to overflow a 2^32 integer:
This works. Returns 2130706433
set ip 127.0.0.1
This works. Should return 377299345
set ip 22.125.33.145
This does not work. Should return 4211081210
set ip 250.255.255.250
scan $ip {%d.%d.%d.%d} a b c d
set dec [expr {[expr {$a <<24}] + [expr {$b <<16}] + [expr {$c <<8}] + $d }]
Anyone have suggestions on converting a dotted IP address to decimal format?
Aaron
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