From 1dbe5bc0d17fbe95c337407fa274bd8f2f953362 Mon Sep 17 00:00:00 2001 From: usa Date: Fri, 17 Jul 2009 13:40:59 +0000 Subject: * ext/socket/socket.c (socket_s_ip_address_list): drop inactive adapters. * test/socket/test_{nonblock,addrinfo,socket}.rb: skip some tests on Windows. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/socket/socket.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'ext/socket') diff --git a/ext/socket/socket.c b/ext/socket/socket.c index d041293a6..a2e14b32d 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -1693,7 +1693,7 @@ socket_s_ip_address_list(VALUE self) DWORD dummy9; DWORD dummy10; DWORD IfType; - int dummy11; + int OperStatus; DWORD dummy12; DWORD dummy13[16]; void *dummy14; @@ -1733,12 +1733,22 @@ socket_s_ip_address_list(VALUE self) for (; adapters; adapters = adapters->Next) { ip_adapter_unicast_address_t *uni; ip_adapter_anycast_address_t *any; + if (adapters->OperStatus != 1) /* 1 means IfOperStatusUp */ + continue; for (uni = adapters->FirstUnicastAddress; uni; uni = uni->Next) { +#ifndef INET6 + if (uni->Address.lpSockaddr->sa_family == AF_INET) +#else if (IS_IP_FAMILY(uni->Address.lpSockaddr->sa_family)) +#endif rb_ary_push(list, sockaddr_obj(uni->Address.lpSockaddr)); } for (any = adapters->FirstAnycastAddress; any; any = any->Next) { +#ifndef INET6 + if (any->Address.lpSockaddr->sa_family == AF_INET) +#else if (IS_IP_FAMILY(any->Address.lpSockaddr->sa_family)) +#endif rb_ary_push(list, sockaddr_obj(any->Address.lpSockaddr)); } } -- cgit