Project

General

Profile

Bug #11701

recvmsg for UDP without argument

Added by akr (Akira Tanaka) almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:71517]

Description

It seems recvmsg without argument doesn't work well for UDP now.

Following example sends a packet which size is 10000 bytes but
receives a packet which size is 4096 bytes.

% ./ruby -rsocket -ve 's1 = Addrinfo.udp("127.0.0.1", 0).bind             
s2 = s1.connect_address.connect
s2.send("a"*10000, 0)
ret = s1.recvmsg
p ret[0].length
'
ruby 2.3.0dev (2015-11-17 trunk 52613) [x86_64-linux]
4096

ruby-2.3.0-preview1 worked well.
It receives a packet which size is 10000 bytes.

% ruby-2.3.0-preview1 -rsocket -ve 's1 = Addrinfo.udp("127.0.0.1", 0).bind
s2 = s1.connect_address.connect
s2.send("a"*10000, 0)
ret = s1.recvmsg
p ret[0].length
'
ruby 2.3.0preview1 (2015-11-11 trunk 52539) [x86_64-linux]
10000

This behavior (recvmsg without arguments) is documented as follows:

maxmesglen and maxcontrollen can
be nil. In that case, the buffer will be grown until the message is not
truncated. Internally, MSG_PEEK is used and MSG_TRUNC/MSG_CTRUNC are checked.

Associated revisions

Revision 508b5fdd
Added by normal almost 4 years ago

socket: fix recvmsg without argument

  • ext/socket/ancdata.c (bsock_recvmsg_internal): grow buffer on unspecified maxdatlen [ruby-core:71517] [Bug #11701]
  • ext/socket/lib/socket.rb (Socket#recvmsg): nil default for dlen (Socket#recvmsg_nonblock): ditto
  • test/socket/test_socket.rb (test_recvmsg_udp_no_arg): new test

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

Revision 52625
Added by normalperson (Eric Wong) almost 4 years ago

socket: fix recvmsg without argument

  • ext/socket/ancdata.c (bsock_recvmsg_internal): grow buffer on unspecified maxdatlen [ruby-core:71517] [Bug #11701]
  • ext/socket/lib/socket.rb (Socket#recvmsg): nil default for dlen (Socket#recvmsg_nonblock): ditto
  • test/socket/test_socket.rb (test_recvmsg_udp_no_arg): new test

Revision 52625
Added by normal almost 4 years ago

socket: fix recvmsg without argument

  • ext/socket/ancdata.c (bsock_recvmsg_internal): grow buffer on unspecified maxdatlen [ruby-core:71517] [Bug #11701]
  • ext/socket/lib/socket.rb (Socket#recvmsg): nil default for dlen (Socket#recvmsg_nonblock): ditto
  • test/socket/test_socket.rb (test_recvmsg_udp_no_arg): new test

Revision 52625
Added by normal almost 4 years ago

socket: fix recvmsg without argument

  • ext/socket/ancdata.c (bsock_recvmsg_internal): grow buffer on unspecified maxdatlen [ruby-core:71517] [Bug #11701]
  • ext/socket/lib/socket.rb (Socket#recvmsg): nil default for dlen (Socket#recvmsg_nonblock): ditto
  • test/socket/test_socket.rb (test_recvmsg_udp_no_arg): new test

Revision 52625
Added by normal almost 4 years ago

socket: fix recvmsg without argument

  • ext/socket/ancdata.c (bsock_recvmsg_internal): grow buffer on unspecified maxdatlen [ruby-core:71517] [Bug #11701]
  • ext/socket/lib/socket.rb (Socket#recvmsg): nil default for dlen (Socket#recvmsg_nonblock): ditto
  • test/socket/test_socket.rb (test_recvmsg_udp_no_arg): new test

Revision 52625
Added by normal almost 4 years ago

socket: fix recvmsg without argument

  • ext/socket/ancdata.c (bsock_recvmsg_internal): grow buffer on unspecified maxdatlen [ruby-core:71517] [Bug #11701]
  • ext/socket/lib/socket.rb (Socket#recvmsg): nil default for dlen (Socket#recvmsg_nonblock): ditto
  • test/socket/test_socket.rb (test_recvmsg_udp_no_arg): new test

History

Updated by normalperson (Eric Wong) almost 4 years ago

akr@fsij.org wrote:

Bug #11701: recvmsg for UDP without argument
https://bugs.ruby-lang.org/issues/11701

Oops, will take a look...

#2

Updated by Anonymous almost 4 years ago

  • Status changed from Open to Closed

Applied in changeset r52625.


socket: fix recvmsg without argument

  • ext/socket/ancdata.c (bsock_recvmsg_internal): grow buffer on unspecified maxdatlen [ruby-core:71517] [Bug #11701]
  • ext/socket/lib/socket.rb (Socket#recvmsg): nil default for dlen (Socket#recvmsg_nonblock): ditto
  • test/socket/test_socket.rb (test_recvmsg_udp_no_arg): new test

Also available in: Atom PDF