Open Bug 1257719 Opened 9 years ago Updated 2 months ago

Accept IPv6 connections to Marionette

Categories

(Remote Protocol :: Marionette, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: juangj, Unassigned)

References

Details

(Keywords: pi-marionette-server)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36 Steps to reproduce: I want to be able to run tests with Marionette in an IPv6-only environment (i.e., IPv4 is not available at all). Actual results: 1458265385732 Marionette ERROR Error on starting server: [Exception... "Component returned failure code: 0x804b0035 (NS_ERROR_SOCKET_ADDRESS_NOT_SUPPORTED) [nsIServerSocket.initSpecialConnection]" nsresult: "0x804b0035 (NS_ERROR_SOCKET_ADDRESS_NOT_SUPPORTED)" location: "JS frame :: chrome://marionette/content/server.js :: MarionetteServer.prototype.start :: line 108" data: no] [Exception... "Component returned failure code: 0x804b0035 (NS_ERROR_SOCKET_ADDRESS_NOT_SUPPORTED) [nsIServerSocket.initSpecialConnection]" nsresult: "0x804b0035 (NS_ERROR_SOCKET_ADDRESS_NOT_SUPPORTED)" location: "JS frame :: chrome://marionette/content/server.js :: MarionetteServer.prototype.start :: line 108" data: no] MarionetteServer.prototype.start@chrome://marionette/content/server.js:108:19 MarionetteComponent.prototype.init@resource://gre/components/marionettecomponent.js:165:5 MarionetteComponent.prototype.observe@resource://gre/components/marionettecomponent.js:103:7 Expected results: Marionette should listen for both IPv4 and IPv6 connections so that clients can connect with either IP version, even if the other isn't available.
Any opinions here? I understand this may require changes beyond just Marionette, so let me know if I should move it somewhere.
(In reply to juangj from comment #1) > Any opinions here? I understand this may require changes beyond just > Marionette, so let me know if I should move it somewhere. Marionette relies on nsIServerSocket to serve TCP to clients. jryans, does that support IPv6? Do we have to do something special?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(jryans)
(In reply to Andreas Tolfsen ‹:ato› from comment #2) > (In reply to juangj from comment #1) > > Any opinions here? I understand this may require changes beyond just > > Marionette, so let me know if I should move it somewhere. > > Marionette relies on nsIServerSocket to serve TCP to clients. jryans, does > that support IPv6? Do we have to do something special? DevTools hasn't tried to use IPv6 explicitly, so I'm not very confident one way or the other, but let's see... I think the issue is you would to specify an IPv6 address to listen on, but that seems to possible only via the C++ call nsServerSocket::InitWithAddress[1]. The JS accessible code paths[2] seem to set PR_AF_INET which means IPv4 IIRC. Forwarding to :mcmanus to confirm. [1]: https://dxr.mozilla.org/mozilla-central/rev/fc15477ce628599519cb0055f52cc195d640dc94/netwerk/base/nsServerSocket.cpp#338 [2]: https://dxr.mozilla.org/mozilla-central/rev/fc15477ce628599519cb0055f52cc195d640dc94/netwerk/base/nsServerSocket.cpp#331
Flags: needinfo?(jryans) → needinfo?(mcmanus)
comment 3 seems right to me.. that's probably because it takes a PRNetaddr as an argument. I'm fine with you adding a InitWithNetAddt scriptable method that takes a nsINetAddr
Flags: needinfo?(mcmanus)
I'm not sure when exactly, but it looks to me like this was fixed for Marionette sometime in Firefox 51 or before. (Was the TCP code changed sometime in the last year?)
Oh never mind, ignore me, it's not fixed after all. I was just running my tests wrong. (shamecube.gif) I don't suppose anybody would be willing to make that change mentioned in comment 4?
Priority: -- → P3
(In reply to Patrick McManus [:mcmanus] from comment #4) > comment 3 seems right to me.. that's probably because it takes a PRNetaddr > as an argument. > > I'm fine with you adding a InitWithNetAddt scriptable method that takes a > nsINetAddr Patrick, so when we would add this feature how would the behavior of Firefox change in terms of to which hosts it binds to? Would it be depended on the settings in the hosts file, or only bind to IPv6? From our side we would like to see that it depends on the hosts file.
Severity: normal → S3
Product: Testing → Remote Protocol

I recently hit this in bug 1849143.
I think we should have everything necessary to allow both IPv4 and IPv6 now.
You can either use nsIServerSocket::initDualStack, but note that this listens on all interfaces, not just localhost.
Alternatively you could also use a different socket in TCPListener.setAcceptConnections that listens using nsIServerSocket::initIPv6

See Also: → 1849143
You need to log in before you can comment on or make changes to this bug.