Page 1 of 1

Feature request: convert decimal to hexadecimal format

Posted: Fri Jun 25, 2010 12:21 am
by oreggin
http://wiki.mikrotik.com/wiki/Manual:IP ... 29_tunnels

Link above describe howto set up an 6to4 relay on ROS but one thing is missing:
Now you need to add a IPv6 address to the tunnel interface. The address should be in form "2002 + <IPv4 address in hex> + <custom id>" . A bash script can be used to generate such IPv6 address for you:
atis@atis-desktop:~$ ipv4="1.2.3.4"; id="1"; printf "2002:%02x%02x:%02x%02x::$id\n" `echo $ipv4 | tr "." " "`
2002:0102:0304::1
It would be nice if I can do this in ROS scripting as converting decimal number to hexadecimal format is missing from ROS scripting at the moment.

Re: Feature request: convert decimal to hexadecimal format

Posted: Fri Jun 25, 2010 6:18 pm
by Sob

Re: Feature request: convert decimal to hexadecimal format

Posted: Fri Jun 25, 2010 7:47 pm
by oreggin
Ehh, nice work but while this script part is 25 lines long then this should be 1 line ":tohex" for example...
I hope your work will provide inspiration to ROS developer too :)

Re: Feature request: convert decimal to hexadecimal format

Posted: Sat Jun 26, 2010 12:53 am
by oreggin
Ehh, nice work but while this script part is 25 lines long then this should be 1 line ":tohex" for example...
Nahh, ok then 5 lines with kindness :)

Re: Feature request: convert decimal to hexadecimal format

Posted: Sat Jun 26, 2010 3:01 am
by Sob
I'd also like to have :tohex, it was just if you really needed some solution (even if not elegant) right now without waiting. :)

Btw, to developers, if :tohex is implemented, then please not just :tohex <number> but :tohex <number> <width>

Re: Feature request: convert decimal to hexadecimal format

Posted: Tue Jun 29, 2010 12:12 am
by oreggin
I'd also like to have :tohex, it was just if you really needed some solution (even if not elegant) right now without waiting. :)
I had already integrated into my script, works fine :)