Bug in ipaddr.rb

K

kishor.gurtu

ipaddr.to_i returns a wrong value. For ex. 192.168.10.5 should return
84584640. Instead, it returns 3232238085.

I think the algorithm has got its byte order reversed.

Kishor.
 
T

ts

k> ipaddr.to_i returns a wrong value. For ex. 192.168.10.5 should return
k> 84584640. Instead, it returns 3232238085.

Well, apparently #to_i give the value in host byte order, when you expect
probably network byte order.
 
D

David Roberts

ipaddr.to_i returns a wrong value. For ex. 192.168.10.5 should return
84584640. Instead, it returns 3232238085.

I think the algorithm has got its byte order reversed.

Kishor.

Looks right to me -

192*16777216 + 168*65536 + 10*256 + 5 = 3232238085
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top