summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jstests/noPassthrough/bind_localhost.js15
-rw-r--r--src/mongo/transport/transport_layer_asio.cpp1
2 files changed, 16 insertions, 0 deletions
diff --git a/jstests/noPassthrough/bind_localhost.js b/jstests/noPassthrough/bind_localhost.js
new file mode 100644
index 00000000000..959c4b70541
--- /dev/null
+++ b/jstests/noPassthrough/bind_localhost.js
@@ -0,0 +1,15 @@
+// Log bound addresses at startup.
+
+(function() {
+ 'use strict';
+
+ const mongo = MongoRunner.runMongod({ipv6: '', bind_ip: 'localhost', useLogFiles: true});
+ assert.neq(mongo, null, "Database is not running");
+ const log = cat(mongo.fullOptions.logFile);
+ print(log);
+ assert(log.includes('Listening on 127.0.0.1'), "Not listening on AF_INET");
+ if (!_isWindows()) {
+ assert(log.match(/Listening on .*\.sock/), "Not listening on AF_UNIX");
+ }
+ MongoRunner.stopMongod(mongo);
+}());
diff --git a/src/mongo/transport/transport_layer_asio.cpp b/src/mongo/transport/transport_layer_asio.cpp
index c41c5d6be68..59659ba3378 100644
--- a/src/mongo/transport/transport_layer_asio.cpp
+++ b/src/mongo/transport/transport_layer_asio.cpp
@@ -776,6 +776,7 @@ Status TransportLayerASIO::start() {
for (auto& acceptor : _acceptors) {
acceptor.second.listen(serverGlobalParams.listenBacklog);
_acceptConnection(acceptor.second);
+ log() << "Listening on " << acceptor.first.getAddr();
}
_listenerThread = stdx::thread([this] {