Bug 1474895 - Only listen on loopback to avoid constant firewall warnings.
authorLogan Smyth <loganfsmyth@gmail.com>
Fri, 05 Oct 2018 02:01:37 +0000
changeset 488440 1bbb6f80f5d9b3275ca9986a276fa1ae510da710
parent 488439 3ded0ccdc4a548190faf633dca587cd11744b6f4
child 488441 b59cdee372577eba70443e114d9996c62f4b51fb
push id246
push userfmarier@mozilla.com
push dateSat, 13 Oct 2018 00:15:40 +0000
bugs1474895
milestone64.0a1
Bug 1474895 - Only listen on loopback to avoid constant firewall warnings. Differential Revision: https://phabricator.services.mozilla.com/D7233
testing/mochitest/ssltunnel/ssltunnel.cpp
--- a/testing/mochitest/ssltunnel/ssltunnel.cpp
+++ b/testing/mochitest/ssltunnel/ssltunnel.cpp
@@ -970,18 +970,20 @@ void StartServer(void* data)
 
   // In case the socket is still open in the TIME_WAIT state from a previous
   // instance of ssltunnel we ask to reuse the port.
   PRSocketOptionData socket_option;
   socket_option.option = PR_SockOpt_Reuseaddr;
   socket_option.value.reuse_addr = true;
   PR_SetSocketOption(listen_socket.get(), &socket_option);
 
+  // Explicitly listen on loopback to avoid users getting errors from their
+  // firewalls about ssltunnel needing permission.
   PRNetAddr server_addr;
-  PR_InitializeNetAddr(PR_IpAddrAny, si->listen_port, &server_addr);
+  PR_InitializeNetAddr(PR_IpAddrLoopback, si->listen_port, &server_addr);
   if (PR_Bind(listen_socket.get(), &server_addr) != PR_SUCCESS) {
     LOG_ERROR(("failed to bind socket on port %d: error %d\n", si->listen_port, PR_GetError()));
     SignalShutdown();
     return;
   }
 
   if (PR_Listen(listen_socket.get(), 1) != PR_SUCCESS) {
     LOG_ERROR(("failed to listen on socket\n"));