diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-05 15:14:23 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-05 15:14:23 +0000 |
commit | 667af1ee3149ba51a5559a3db3d1fc52fda06bed (patch) | |
tree | b39bc8069e54f596b8cf89829bf202fe96a3f661 /include | |
parent | aac5c2c7affaa188b84c4f9ccf8b21e83aa21141 (diff) |
merge revision(s) r45046,r45047,r45063,r45087,r45146,r45150,r45151,r45152: [Backport #9525]
* ext/socket: Wrap struct addrinfo by struct rb_addrinfo.
* ext/socket: Bypass getaddrinfo() if node and serv are numeric.
Reporeted by Naotoshi Seo. [ruby-core:60801] [Bug #9525]
* ext/socket/extconf.rb: Detect struct sockaddr_in6.sin6_len.
* ext/socket/sockport.h (SET_SIN6_LEN): New macro.
(INIT_SOCKADDR_IN6): Ditto.
* ext/socket/rubysocket.h (struct rb_addrinfo): Add
allocated_by_malloc field.
* ext/socket/raddrinfo.c (numeric_getaddrinfo): New function.
(rb_getaddrinfo): Call numeric_getaddrinfo at first.
(rb_freeaddrinfo): Free struct addrinfo properly when it is
allocated by numeric_getaddrinfo.
* ext/socket/raddrinfo.c (numeric_getaddrinfo): Use xcalloc.
Suggested by Eric Wong.
https://bugs.ruby-lang.org/issues/9525#note-14
* ext/socket/raddrinfo.c (rb_getaddrinfo): second argument of
MEMZERO is type. Coverity Scan found this bug.
* include/ruby/win32.h, win32/win32.c (rb_w32_inet_pton): add a
wrapper function for inet_pton minimum supported client is
Vista, as well as inet_ntop.
* ext/socket/option.c (inet_pton): use rb_w32_inet_pton, instead of
inet_ntop directly, which is unavailable on older version Windows.
* ext/socket/raddrinfo.c (inet_pton): use rb_w32_inet_pton, instead of
inet_pton directly, which is unavailable on older version Windows.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include')
-rw-r--r-- | include/ruby/win32.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/ruby/win32.h b/include/ruby/win32.h index 067ac010da..64fbdf2744 100644 --- a/include/ruby/win32.h +++ b/include/ruby/win32.h @@ -309,6 +309,7 @@ extern char **rb_w32_get_environ(void); extern void rb_w32_free_environ(char **); extern int rb_w32_map_errno(DWORD); extern const char *WSAAPI rb_w32_inet_ntop(int,const void *,char *,size_t); +extern int WSAAPI rb_w32_inet_pton(int,const char *,void *); extern DWORD rb_w32_osver(void); extern int chown(const char *, int, int); @@ -652,6 +653,9 @@ extern char *rb_w32_strerror(int); #undef inet_ntop #define inet_ntop(f,a,n,l) rb_w32_inet_ntop(f,a,n,l) +#undef inet_pton +#define inet_pton(f,s,d) rb_w32_inet_pton(f,s,d) + #undef accept #define accept(s, a, l) rb_w32_accept(s, a, l) |