Hi,

I faced the following issue on GNU/Linux i686. Seems to me that there is
a bug in host_str() in socket.c.


irb(main):001:0> require 'socket'
=> true
irb(main):002:0> Socket.pack_sockaddr_in(0, '192.168.1.1')
=> "\002\000\000\000\300\250\001\001\000\000\000\000\000\000\000\000"
irb(main):003:0> Socket.pack_sockaddr_in(0, 0xc0a80101)
RangeError: bignum too big to convert into `long'
	from (irb):3:in `pack_sockaddr_in'
	from (irb):3
	from :0


I guess the problem is in ext/socket/socket.c:866: host_str() function.
The function goes like this ...
...
static char*
host_str(VALUE host, char *hbuf, size_t len)
{
    if (NIL_P(host)) {
	return NULL;
    }
    else if (rb_obj_is_kind_of(host, rb_cInteger)) {
	long i = NUM2LONG(host);

	make_inetaddr(htonl(i), hbuf, len);
	return hbuf;
...

In the above snippet, i feel instead of 
	long i = NUM2LONG(host);
it should be
        unsigned long i = NUM2ULONG(host);
as htonl accepts uint32_t.


-Aravind.