diff --git a/Serverland/controller/Controller.js b/Serverland/controller/Controller.js index 6a4d9d2..190ee3c 100644 --- a/Serverland/controller/Controller.js +++ b/Serverland/controller/Controller.js @@ -66,23 +66,18 @@ module.exports = class Controller { var alias = 0; ifaces[ifname].forEach(function (iface) { - if ('IPv4' !== iface.family || iface.internal !== false) { + if ('IPv4' !== iface.family || iface.internal !== false) { // skip over internal (i.e. 127.0.0.1) and non-ipv4 addresses + alias++; return; } - if (alias >= 1) { - // this single interface has multiple ipv4 addresses - //console.log(ifname + ':' + alias, iface.address); - } else { - // this interface has only one ipv4 adress - //console.log(ifname, iface.address, iface.netmask); - if(searchIf == ""){ - searchIf = ifname; - searchalias = alias+1; - } + // use first external ipv4 address found in interface + // this may cause the wrong address to be selected if there are multiple ipv4 addresses in the interface + if(searchIf == ""){ + searchIf = ifname; + searchalias = alias; } - ++alias; }); });