Skip to content

Fix #recvfrom to match stdlib#83

Open
zeroSteiner wants to merge 5 commits into
rapid7:masterfrom
zeroSteiner:fix/udp/recvfrom-api
Open

Fix #recvfrom to match stdlib#83
zeroSteiner wants to merge 5 commits into
rapid7:masterfrom
zeroSteiner:fix/udp/recvfrom-api

Conversation

@zeroSteiner

@zeroSteiner zeroSteiner commented May 15, 2026

Copy link
Copy Markdown
Contributor

This is related to #82 but unlike #82, this is a breaking change. It updates the #recvfrom signature to match that of the standard library. This was raised first here: rapid7/metasploit-framework#20689 (comment) and was highlighted by the condition required here: https://github.com/Z6543/ruby_smb/blob/679da4dba6bb4256ff1b79527d5d0c6f8cc6fd76/lib/ruby_smb/nbss/node_status.rb#L215-L224

zeroSteiner and others added 3 commits June 10, 2026 17:00
Make Rex::Socket::Udp#recvfrom a true drop-in for stdlib
UDPSocket#recvfrom: it now blocks until a datagram arrives (no internal
def_read_timeout / Errno::EAGAIN deadline) and returns
[ data, [address_family, port, host, host] ].

Callers that need a deadline use the new #timed_recvfrom, which returns
the same stdlib-shaped tuple and nil when the timeout elapses -- mirroring
the read/timed_read pair. #timed_read is left as-is.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@zeroSteiner zeroSteiner force-pushed the fix/udp/recvfrom-api branch from 480f12c to 1c1e60b Compare June 10, 2026 21:00
zeroSteiner added a commit to zeroSteiner/metasploit-framework that referenced this pull request Jun 11, 2026
This pulls in changes from rapid7/rex-socket#83 which aligns #recvfrom
to match the signature and behavior of the standard library in regards
to it's arguments, return type and how it handles timeouts. The
historical usage of #recvfrom was a timed read and can now be replaced
with #timed_recvfrom.
zeroSteiner added a commit to zeroSteiner/metasploit-framework that referenced this pull request Jun 11, 2026
This pulls in changes from rapid7/rex-socket#83 which aligns #recvfrom
to match the signature and behavior of the standard library in regards
to it's arguments, return type and how it handles timeouts. The
historical usage of #recvfrom was a timed read and can now be replaced
with #timed_recvfrom.
@sjanusz-r7 sjanusz-r7 self-assigned this Jun 16, 2026
Comment thread lib/rex/socket/udp.rb Outdated
Comment thread spec/rex/socket/udp_spec.rb Outdated
@zeroSteiner zeroSteiner requested a review from sjanusz-r7 June 16, 2026 19:00
zeroSteiner added a commit to zeroSteiner/metasploit-framework that referenced this pull request Jun 17, 2026
This pulls in changes from rapid7/rex-socket#83 which aligns #recvfrom
to match the signature and behavior of the standard library in regards
to it's arguments, return type and how it handles timeouts. The
historical usage of #recvfrom was a timed read and can now be replaced
with #timed_recvfrom.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants