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

net: _connectionKey given wrong value for large port #5727

Closed
trevnorris opened this issue Mar 15, 2016 · 2 comments
Closed

net: _connectionKey given wrong value for large port #5727

trevnorris opened this issue Mar 15, 2016 · 2 comments
Labels
good first issue Issues that are suitable for first-time contributors. net Issues and PRs related to the net subsystem.

Comments

@trevnorris
Copy link
Contributor

  • Version: v0.12+
  • Platform: all
  • Subsystem: net, affects child_process

Reproduce with:

$ node -e "var s = require('net').createServer().listen(-1 >>> 0); console.log(s._connectionKey, s.address().port)"

Output:

6::::4294967295 65535

Expected output:

6::::65535 65535

Conversation with @indutny:

<trevnorris>    indutny: does ._connectionKey do anything?
<indutny>       yep
<indutny>       child_process.js
<indutny>       actually, internal/child_process.js
<indutny>       it is used for sharing servers
<trevnorris>    okay. well guess it should get fixed then.
<trevnorris>    e.g.: var s = net.createServer().listen(-1 >>> 0); s._connectionKey == '6::::4294967295'; s.address().port == 65535
<indutny>       mmm
<indutny>       yeah
<indutny>       this is bad

Haven't gotten around to a fix, so making this up for grabs.

@trevnorris trevnorris added the net Issues and PRs related to the net subsystem. label Mar 15, 2016
@evanlucas evanlucas added the good first issue Issues that are suitable for first-time contributors. label Mar 15, 2016
@cjihrig
Copy link
Contributor

cjihrig commented Mar 15, 2016

We should be able to use s.address().address and s.address().port to build the connection key, right?

@dirceu
Copy link
Contributor

dirceu commented Mar 15, 2016

Actually we validate the port number if we do listen({ port: PORT }), but we don't validate if we use listen(PORT). I created a PR (#5732) to make sure we validate in all cases. Makes sense?

dirceu added a commit to dirceu/node that referenced this issue Apr 20, 2016
Make sure we validate the port number in all kinds of `listen()` calls.

Fixes: nodejs#5727
cjihrig added a commit that referenced this issue Apr 21, 2016
test/parallel/test-regress-GH-5727 assumed that one of the
servers would be listening on IPv6. This breaks when the machine
running the test doesn't have IPv6. This commit builds the
connection key that is compared dynamically.

Refs: #5732
PR-URL: #6319
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
joelostrowski pushed a commit to joelostrowski/node that referenced this issue Apr 25, 2016
Make sure we validate the port number in all kinds of `listen()` calls.

Fixes: nodejs#5727
PR-URL: nodejs#5732
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
joelostrowski pushed a commit to joelostrowski/node that referenced this issue Apr 25, 2016
test/parallel/test-regress-GH-5727 assumed that one of the
servers would be listening on IPv6. This breaks when the machine
running the test doesn't have IPv6. This commit builds the
connection key that is compared dynamically.

Refs: nodejs#5732
PR-URL: nodejs#6319
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
jasnell pushed a commit that referenced this issue Apr 26, 2016
Make sure we validate the port number in all kinds of `listen()` calls.

Fixes: #5727
PR-URL: #5732
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
jasnell pushed a commit that referenced this issue Apr 26, 2016
test/parallel/test-regress-GH-5727 assumed that one of the
servers would be listening on IPv6. This breaks when the machine
running the test doesn't have IPv6. This commit builds the
connection key that is compared dynamically.

Refs: #5732
PR-URL: #6319
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
addaleax pushed a commit that referenced this issue Apr 27, 2017
Removed common.PORT from test-regress-GH-5051 and
test-regress-GH-5727 in order to eliminate the possibility
of port collision.

Refs: #12376
PR-URL: #12639
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
gibfahn pushed a commit that referenced this issue Jun 18, 2017
Removed common.PORT from test-regress-GH-5051 and
test-regress-GH-5727 in order to eliminate the possibility
of port collision.

Refs: #12376
PR-URL: #12639
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
gibfahn pushed a commit that referenced this issue Jun 20, 2017
Removed common.PORT from test-regress-GH-5051 and
test-regress-GH-5727 in order to eliminate the possibility
of port collision.

Refs: #12376
PR-URL: #12639
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
MylesBorins pushed a commit that referenced this issue Jul 11, 2017
Removed common.PORT from test-regress-GH-5051 and
test-regress-GH-5727 in order to eliminate the possibility
of port collision.

Refs: #12376
PR-URL: #12639
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
ryzokuken added a commit to ryzokuken/node that referenced this issue Mar 13, 2018
Rename the tests appropriately alongside mentioning the subsystem
Also, make a few basic changes to make sure the tests conform
to the standard test structure

- Rename test-regress-nodejsGH-9819 to test-crypto-tostring-segfault
- Rename test-regress-nodejsGH-5051 to test-http-addrequest-localaddress
- Rename test-regress-nodejsGH-5727 to test-net-listen-invalid-port
- Rename test-regress-nodejsGH-5927 to test-tty-stdin-pipe
- Rename test-regress-nodejsGH-6235 to test-v8-global-setter

Refs: nodejs#19105
Refs: https://github.com/nodejs/node/blob/master/doc/guides/writing-tests.md#test-structure
lpinca pushed a commit that referenced this issue Mar 13, 2018
Rename the tests appropriately alongside mentioning the subsystem.
Also, make a few basic changes to make sure the tests conform to the
standard test structure.

- Rename test-regress-GH-9819 to test-crypto-tostring-segfault
- Rename test-regress-GH-5051 to test-http-addrequest-localaddress
- Rename test-regress-GH-5727 to test-net-listen-invalid-port
- Rename test-regress-GH-5927 to test-tty-stdin-pipe
- Rename test-regress-GH-6235 to test-v8-global-setter

PR-URL: #19275
Refs: #19105
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this issue Mar 20, 2018
Rename the tests appropriately alongside mentioning the subsystem.
Also, make a few basic changes to make sure the tests conform to the
standard test structure.

- Rename test-regress-GH-9819 to test-crypto-tostring-segfault
- Rename test-regress-GH-5051 to test-http-addrequest-localaddress
- Rename test-regress-GH-5727 to test-net-listen-invalid-port
- Rename test-regress-GH-5927 to test-tty-stdin-pipe
- Rename test-regress-GH-6235 to test-v8-global-setter

PR-URL: #19275
Refs: #19105
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this issue Mar 20, 2018
Rename the tests appropriately alongside mentioning the subsystem.
Also, make a few basic changes to make sure the tests conform to the
standard test structure.

- Rename test-regress-GH-9819 to test-crypto-tostring-segfault
- Rename test-regress-GH-5051 to test-http-addrequest-localaddress
- Rename test-regress-GH-5727 to test-net-listen-invalid-port
- Rename test-regress-GH-5927 to test-tty-stdin-pipe
- Rename test-regress-GH-6235 to test-v8-global-setter

PR-URL: #19275
Refs: #19105
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
MayaLekova pushed a commit to MayaLekova/node that referenced this issue May 8, 2018
Rename the tests appropriately alongside mentioning the subsystem.
Also, make a few basic changes to make sure the tests conform to the
standard test structure.

- Rename test-regress-nodejsGH-9819 to test-crypto-tostring-segfault
- Rename test-regress-nodejsGH-5051 to test-http-addrequest-localaddress
- Rename test-regress-nodejsGH-5727 to test-net-listen-invalid-port
- Rename test-regress-nodejsGH-5927 to test-tty-stdin-pipe
- Rename test-regress-nodejsGH-6235 to test-v8-global-setter

PR-URL: nodejs#19275
Refs: nodejs#19105
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issues that are suitable for first-time contributors. net Issues and PRs related to the net subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants