From a59dbdc4e190c05496bcdded2dfb682c5f06ecd1 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 3 May 2022 12:02:05 -0400 Subject: [PATCH 1/2] Fixes bug where public_addr was autoconfigured irrespective of not being 0.0.0.0 --- src/engine/server/login/LoginServer.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/engine/server/login/LoginServer.java b/src/engine/server/login/LoginServer.java index 07da1326..6f41b047 100644 --- a/src/engine/server/login/LoginServer.java +++ b/src/engine/server/login/LoginServer.java @@ -271,17 +271,20 @@ public class LoginServer { String name = ConfigManager.MB_WORLD_NAME.getValue(); - // Find publicIP address for use in worldserver response - // message. Sending the client to an unroutable address - // doesn't work so well. + + if (ConfigManager.MB_PUBLIC_ADDR.getValue().equals("0.0.0.0")) { + + // Autoconfigure IP address for use in worldserver response + // message. URL whatismyip = new URL("http://checkip.amazonaws.com"); BufferedReader in = new BufferedReader(new InputStreamReader( whatismyip.openStream())); ConfigManager.MB_PUBLIC_ADDR.setValue(in.readLine()); - Logger.info("Public address: " + ConfigManager.MB_PUBLIC_ADDR.getValue()); + } - Logger.info("Magicbane network config: " + ConfigManager.MB_BIND_ADDR.getValue() + ":" + ConfigManager.MB_LOGIN_PORT.getValue()); + Logger.info("Public address: " + ConfigManager.MB_PUBLIC_ADDR.getValue()); + Logger.info("Magicbane bind config: " + ConfigManager.MB_BIND_ADDR.getValue() + ":" + ConfigManager.MB_LOGIN_PORT.getValue()); InetAddress addy = InetAddress.getByName(ConfigManager.MB_BIND_ADDR.getValue()); int port = Integer.parseInt(ConfigManager.MB_LOGIN_PORT.getValue()); -- 2.30.2 From 24057e6412d2ff04d886a0ec7214fb026819b372 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 3 May 2022 12:23:45 -0400 Subject: [PATCH 2/2] Logging when network autoconfig occurs --- src/engine/server/login/LoginServer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/server/login/LoginServer.java b/src/engine/server/login/LoginServer.java index 6f41b047..b7ad18e9 100644 --- a/src/engine/server/login/LoginServer.java +++ b/src/engine/server/login/LoginServer.java @@ -275,8 +275,8 @@ public class LoginServer { if (ConfigManager.MB_PUBLIC_ADDR.getValue().equals("0.0.0.0")) { // Autoconfigure IP address for use in worldserver response - // message. - + // . + Logger.info("AUTOCONFIG PUBLIC IP ADDRESS"); URL whatismyip = new URL("http://checkip.amazonaws.com"); BufferedReader in = new BufferedReader(new InputStreamReader( whatismyip.openStream())); -- 2.30.2