Skip to content

Commit

Permalink
Fixed network discovery when multiple ipv6 addresses have to be skipped
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-kraus committed Sep 16, 2020
1 parent 095972f commit 93e5471
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions Serverland/controller/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
});

Expand Down

0 comments on commit 93e5471

Please sign in to comment.