Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dgram: socket.send without address fails with weird error on 5.7 #5398

Closed
mafintosh opened this issue Feb 23, 2016 · 3 comments
Closed

dgram: socket.send without address fails with weird error on 5.7 #5398

mafintosh opened this issue Feb 23, 2016 · 3 comments
Assignees
Labels
confirmed-bug Issues with confirmed bugs. dgram Issues and PRs related to the dgram subsystem / UDP.
Milestone

Comments

@mafintosh
Copy link
Member

On node 4.x and node <5.7 this worked

var dgram = require('dgram')
var socket = dgram.createSocket('udp4')

socket.send(Buffer('hi'), 0, 2, 10000) // works on 4.x <5.7

With node 5.7 this fails with

RangeError: Port should be > 0 and < 65536

The dgram docs on both 4.x and 5.x say

 If the address is not specified or is an empty string, '0.0.0.0' or '::0' will be used instead
  • Version: v5.7.0
  • Platform: Darwin brunhilde.local 15.2.0 Darwin Kernel Version 15.2.0: Fri Nov 13 19:56:56 PST 2015; root:xnu-3248.20.55~2/RELEASE_X86_64 x86_64
mafintosh added a commit to mafintosh/dns-socket that referenced this issue Feb 23, 2016
@silverwind silverwind added the dgram Issues and PRs related to the dgram subsystem / UDP. label Feb 23, 2016
@Fishrock123
Copy link
Contributor

cc @mcollina

@mcollina
Copy link
Member

Yes it was me. Here is the infringing lines: https://github.com/nodejs/node/blob/master/lib/dgram.js#L298-L299.
I will send a PR tomorrow and I will add a unit test, so we avoid further regression on this area.

Thanks @Fishrock123 for routing this.

@reqshark
Copy link

good catch @mafintosh

@Fishrock123 Fishrock123 modified the milestone: v5.7.1 Feb 23, 2016
@Fishrock123 Fishrock123 mentioned this issue Feb 23, 2016
3 tasks
@mcollina mcollina self-assigned this Feb 24, 2016
@silverwind silverwind added the confirmed-bug Issues with confirmed bugs. label Feb 27, 2016
mcollina added a commit to mcollina/node that referenced this issue Feb 27, 2016
Fixes a regression introduced by: nodejs#4374.
Adds a new test to avoid similar issue in the future.

Fixes: nodejs#5398
Fishrock123 pushed a commit that referenced this issue Mar 2, 2016
Fixes a regression introduced by: #4374.
Adds a new test to avoid similar issue in the future.
The test is disabled on windows, because this feature never worked
there.

Fixes: #5398
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Evan Lucas <evanlucas@me.com>
mcollina added a commit to mcollina/node that referenced this issue Mar 4, 2016
In net we default to 'localhost' as the default address for connect.
Not doing the same on dgram is confusing, because sending to 0.0.0.0
works on Linux/OS X but not on Windows. Defaulting that to 127.0.0.1 /
::1 addresses that.

Related: nodejs#5407
Related: nodejs#5398

Fixes: nodejs#5487
mcollina added a commit that referenced this issue Mar 5, 2016
In net we default to 'localhost' as the default address for connect.
Not doing the same on dgram is confusing, because sending to 0.0.0.0
works on Linux/OS X but not on Windows. Defaulting that to 127.0.0.1 /
::1 addresses that.

Related: #5407
Related: #5398
Fixes: #5487
PR-URL: #5493
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Fishrock123 pushed a commit that referenced this issue Mar 8, 2016
In net we default to 'localhost' as the default address for connect.
Not doing the same on dgram is confusing, because sending to 0.0.0.0
works on Linux/OS X but not on Windows. Defaulting that to 127.0.0.1 /
::1 addresses that.

Related: #5407
Related: #5398
Fixes: #5487
PR-URL: #5493
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Fishrock123 pushed a commit that referenced this issue Mar 8, 2016
In net we default to 'localhost' as the default address for connect.
Not doing the same on dgram is confusing, because sending to 0.0.0.0
works on Linux/OS X but not on Windows. Defaulting that to 127.0.0.1 /
::1 addresses that.

Related: #5407
Related: #5398
Fixes: #5487
PR-URL: #5493
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. dgram Issues and PRs related to the dgram subsystem / UDP.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants