Граф коммитов

92 Коммитов

Автор SHA1 Сообщение Дата
akr 6b0f596719 * ext/socket/ancdata.c (bsock_recvmsg_internal): check max length
overflow.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-21 17:04:22 +00:00
akr 60f2cec646 * ext/socket/ancdata.c (bsock_recvmsg_internal): don't call
discard_cmsg_resource when EMFILE.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-21 16:53:30 +00:00
akr ad2f293d4f * ext/socket/ancdata.c (bsock_recvmsg_internal): gc when SCM_RIGHTS
hit the file descriptor limit.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-21 16:49:44 +00:00
akr 9cfe35ad50 * io.c (io_getpartial): error message describes what should be
waited after nonblocking error.
  (rb_io_write_nonblock): ditto.

* ext/socket/init.c (s_recvfrom_nonblock): ditto.
  (s_accept_nonblock): ditto.

* ext/socket/socket.c (sock_connect_nonblock): ditto.

* ext/socket/ancdata.c (bsock_sendmsg_internal): ditto.
  (bsock_recvmsg_internal): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-21 15:57:52 +00:00
akr d227ca29f4 * ext/socket/ancdata.c (bsock_recvmsg_internal): check recvmsg error
earlier.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-21 15:32:52 +00:00
akr 90fc8d84ad rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-21 14:05:07 +00:00
akr 09396dcf21 * ext/socket/ancdata.c (make_io_for_unix_rights): cmsg_len may be
bigger than msg_controllen.
  freeze unix_rights array.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-19 14:01:17 +00:00
akr 98f82fc633 * ext/socket/ancdata.c (bsock_recvmsg_internal): fix exception.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-19 13:18:02 +00:00
akr bed4294451 * ext/socket/ancdata.c (ancillary_unix_rights): method renamed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-19 12:13:38 +00:00
akr 18afbc891c * ext/socket/ancdata.c (ancillary_rights): new method.
(make_io_for_rights): new function to allocate
  IOs for FDs in SCM_RIGHTS message.
  (bsock_recvmsg_internal): use make_io_for_rights.  So the FDs can be
  closed by GC.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-18 18:43:15 +00:00
akr 75ba47e8e8 * ext/socket/ancdata.c (discard_cmsg_resource): new function to close
file descriptors in control message.
  (bsock_recvmsg_internal): call discard_cmsg_resource before retrying
  recvmsg.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-18 13:47:53 +00:00
akr f1a39b9e5c * ext/socket/ancdata.c (bsock_recvmsg_internal): prevent misalignment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-18 12:48:11 +00:00
akr 34152d654a * ext/socket/ancdata.c (bsock_sendmsg_internal): avoid misalignment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-18 12:35:22 +00:00
akr d89e09b308 * ext/socket/ancdata.c (bsock_recvmsg_internal): reduce code on
environments which have no control message.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-18 12:27:13 +00:00
akr 9bd0ecd917 add comments for rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-17 16:29:43 +00:00
akr 28cf7a6d6f * ext/socket/ancdata.c (bsock_sendmsg_internal): make the padding
removing only on NetBSD.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-17 14:26:34 +00:00
akr 2f8b471b89 fix an error message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-17 10:43:55 +00:00
akr 3d39a9a070 * ext/socket/ancdata.c (bsock_sendmsg_internal): should not remove the
last padding of control messages, basically.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-17 10:40:20 +00:00
akr 351f54de45 * ext/socket/ancdata.c (bsock_sendmsg_internal) [OpenBSD]: don't remove
the last padding to prevent sendmsg failure in test_udp_server in
  test/socket/test_socket.rb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-16 14:34:01 +00:00
akr 760ee609d2 fix rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-13 17:11:32 +00:00
akr 9842858add rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-13 14:43:12 +00:00
akr 5b8339edf6 * ext/socket/ancdata.c (extract_ipv6_pktinfo): set sa_len for 4.4BSD.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-13 12:00:25 +00:00
akr ff955766d4 * ext/socket/ancdata.c (ancillary_s_ip_pktinfo): make 3rd argument
optional.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-11 07:44:53 +00:00
akr 4b036bb69b * ext/socket/ancdata.c (anc_inspect_socket_rights): return 1 on
success.  0 on failure.
  (anc_inspect_passcred_credentials): ditto.
  (anc_inspect_socket_creds): ditto.
  (anc_inspect_socket_creds): ditto.
  (anc_inspect_socket_creds): ditto.
  (anc_inspect_ip_recvdstaddr): ditto.
  (anc_inspect_ip_pktinfo): ditto.
  (anc_inspect_ipv6_pktinfo): ditto.
  (ancillary_inspect): check family.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-11 05:10:47 +00:00
akr c7a66ff804 * ext/socket/ancdata.c (anc_inspect_ip_pktinfo): make result bit
succinct.
  (Init_ancdata): fix number of arguments.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-11 03:56:13 +00:00
akr 2ee0859119 * ext/socket/init.c (struct recvfrom_arg): use struct
sockaddr_storage.
  (recvfrom_blocking): follow struct recvfrom_arg change.
  (s_recvfrom): ditto.
  (s_recvfrom_nonblock): use struct sockaddr_storage.

* ext/socket/socket.c (sock_accept): use struct sockaddr_storage.
  (sock_accept_nonblock): ditto.
  (sock_sysaccept): ditto.

* ext/socket/ancdata.c (bsock_recvmsg_internal): use struct
  sockaddr_storage.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-10 14:46:51 +00:00
akr ba75dd6b95 * ext/socket/ancdata.c (anc_inspect_socket_creds): refactored to avoid
a rb_str_cat2 call.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-10 11:57:07 +00:00
nobu 160c230f94 * ext/socket/option.c (inspect_local_peercred): constfied.
* ext/socket/ancdata.c (anc_inspect_socket_creds): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-10 03:57:23 +00:00
akr 2acc18ad99 rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-10 00:18:53 +00:00
akr c6ea437727 * ext/socket/ancdata.c (ip_cmsg_type_to_sym): renamed from
cmsg_type_to_sym.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-09 16:29:16 +00:00
akr 97ba0d4aa7 * ext/socket/mkconstants.rb: generate intern_family_noprefix.
* ext/socket/option.c (sockopt_inspect): use intern_family_noprefix
  not to show AF_ prefix.

* ext/socket/ancdata.c (ancillary_inspect): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-09 16:03:08 +00:00
akr 2dd3fa9f3e * ext/socket/mkconstants.rb: rename level_to_int to iplevel_to_int.
rename intern_level to intern_iplevel.

* ext/socket/constants.c: follow the renaming.

* ext/socket/option.c: ditto.

* ext/socket/ancdata.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-09 14:05:37 +00:00
akr f5da7031b9 * ext/socket/rubysocket.h (level_arg): add family argument.
(optname_arg): ditto.
  (cmsg_type_arg): ditto.
  (rb_sock_getfamily): declared.

* ext/socket/constants.c (level_arg): add family argument.
  (optname_arg): ditto.
  (cmsg_type_arg): ditto.

* ext/socket/init.c (rb_sock_getfamily): defined.

* ext/socket/option.c (sockopt_initialize): give family for level_arg
  and optname_arg.
  (sockopt_s_int): ditto.

* ext/socket/basicsocket.c (bsock_setsockopt): ditto.
  (bsock_getsockopt): ditto.

* ext/socket/ancdata.c (ancillary_initialize): ditto.
  (ancillary_s_int): ditto.
  (ancillary_cmsg_is_p): ditto.
  (bsock_sendmsg_internal): ditto.
  (bsock_recvmsg_internal): use rb_sock_getfamily.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-09 13:56:43 +00:00
akr ecfea8e28e * ext/socket/ancdata.c (ancillary_inspect): show address family.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-09 12:49:24 +00:00
akr fd9c7e8af1 * ext/socket/ancdata.c (ancillary_initialize): add family argument.
(ancdata_new): ditto.
  (ancillary_s_int): ditto.
  (ancillary_family): new function.
  (ancillary_family_m): new method.
  (ancillary_s_ip_pktinfo): follow ancdata_new change.
  (ancillary_s_ipv6_pktinfo): ditto.
  (bsock_recvmsg_internal): examine the socket address family.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-09 10:49:16 +00:00
akr 411e9997d2 * ext/socket/extconf.rb: check struct cmsgcred.
* ext/socket/ancdata.c (anc_inspect_passcred_credentials): add
  "(ucred)".
  (anc_inspect_socket_creds): show struct cmsgcred too, for FreeBSD.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-08 12:53:55 +00:00
akr e960cf417a * ext/socket/extconf.rb: check struct sockcred.
* ext/socket/ancdata.c (anc_inspect_socket_creds): new function to
  show SCM_CREDS on NetBSD.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-08 11:36:18 +00:00
akr a23547cafa * ext/socket/ancdata.c (anc_inspect_passcred_credentials): new
function to show SCM_CREDENTIALS on GNU/Linux.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-08 09:47:00 +00:00
akr 88f04bdd32 * ext/socket: AddrInfo is renamed to Addrinfo. [ruby-dev:37876]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-05 11:01:43 +00:00
nobu b256c5fb8f * ext/socket/extconf.rb (in_pktinfo, in6_pktinfo),
ext/socket/ancdata.c: defined in w32api/ws2tcpip.h on cygwin but
  cannot compile for some reason.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-02 22:58:03 +00:00
akr 29bd89281b * ext/socket/ancdata.c (cmsg_type_to_sym): add #ifdef for no IPv6
environment.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-02 08:12:10 +00:00
akr 61fc0c6cf4 * ext/socket/rubysocket.h (cmsg_type_arg): declared.
(Init_ancdata): ditto.

* ext/socket/init.c (Init_socket_init): call Init_ancdata.

* ext/socket/constants.c (cmsg_type_arg): defined.

* ext/socket/depend: add dependency for ancdata.o.

* ext/socket/mkconstants.rb: generate scm_optname_to_int.
  more constants.

* ext/socket/extconf.rb: add ancdata.o.

* ext/socket/ancdata.c: new file.  new method
  BasicSocket#{sendmsg,sendmsg_nonblock,recvmsg,recvmsg_nonblock}



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-02 02:51:02 +00:00