networkInterfaces loopback internal detection (windows)

This commit is contained in:
Sebastian Hildebrandt 2020-10-12 13:21:02 +02:00
parent 35d835b61e
commit e756186225

View File

@ -451,7 +451,7 @@ function parseLinesDarwinNics(sections) {
if (isNaN(nic.mtu)) { if (isNaN(nic.mtu)) {
nic.mtu = -1; nic.mtu = -1;
} }
nic.internal = parts[0].indexOf('LOOPBACK') > -1; nic.internal = parts[0].toLowerCase().indexOf('loopback') > -1;
section.forEach(line => { section.forEach(line => {
if (line.trim().startsWith('ether ')) { if (line.trim().startsWith('ether ')) {
nic.mac = line.split('ether ')[1].toLowerCase().trim(); nic.mac = line.split('ether ')[1].toLowerCase().trim();
@ -586,13 +586,13 @@ function getLinuxIfaceDHCPstatus(iface, connectionName, DHCPNics) {
let dhcStatus = resultFormat.split(' ').slice(1).toString(); let dhcStatus = resultFormat.split(' ').slice(1).toString();
switch (dhcStatus) { switch (dhcStatus) {
case 'auto': case 'auto':
result = true; result = true;
break; break;
default: default:
result = false; result = false;
break; break;
} }
return result; return result;
} catch (e) { } catch (e) {
@ -884,7 +884,7 @@ function networkInterfaces(callback, rescan = true) {
ieee8021xAuth = IEEE8021x.protocol; ieee8021xAuth = IEEE8021x.protocol;
ieee8021xState = IEEE8021x.state; ieee8021xState = IEEE8021x.state;
} }
let internal = (ifaces[dev] && ifaces[dev][0]) ? ifaces[dev][0].internal : null; let internal = (ifaces[dev] && ifaces[dev][0]) ? ifaces[dev][0].internal : !!(dev.toLowerCase().indexOf('loopback') > -1 || ifaceName.toLowerCase().indexOf('loopback') > -1);
const virtual = internal ? false : testVirtualNic(dev, ifaceName, mac); const virtual = internal ? false : testVirtualNic(dev, ifaceName, mac);
result.push({ result.push({
iface: dev, iface: dev,