FELIX-4345 - listen to both IPv4 & IPv6 when ip is empty:
- when an empty IP parameter is given, telnetd now binds to all network addresses.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1725532 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Telnet.java b/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Telnet.java
index f38d1b1..d4a215d 100644
--- a/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Telnet.java
+++ b/gogo/shell/src/main/java/org/apache/felix/gogo/shell/Telnet.java
@@ -74,8 +74,7 @@
{
if (server != null)
{
- throw new IllegalStateException("telnetd is already running on port "
- + port);
+ throw new IllegalStateException("telnetd is already running on port " + port);
}
ip = opt.get("ip");
port = opt.getNumber("port");
@@ -115,8 +114,9 @@
private void start() throws IOException
{
quit = false;
- server = new ServerSocket(port, 0, InetAddress.getByName(ip));
- thread = new Thread(this, "gogo telnet");
+ InetAddress addr = "".equals(ip) ? null : InetAddress.getByName(ip);
+ server = new ServerSocket(port, 0, addr);
+ thread = new Thread(this, "Gogo telnet");
thread.start();
}