networkInterfaces() operstate fix (mac OS)

This commit is contained in:
Sebastian Hildebrandt
2022-08-04 07:49:41 +02:00
parent 3f5c79dc0d
commit bc71d324d9
4 changed files with 11 additions and 3 deletions
+3 -1
View File
@@ -494,7 +494,9 @@ function parseLinesDarwinNics(sections) {
}
}
nic.type = util.getValue(section, 'type').toLowerCase().indexOf('wi-fi') > -1 ? 'wireless' : 'wired';
nic.operstate = util.getValue(section, 'status').toLowerCase().indexOf('active') > -1 ? 'up' : 'down';
const operstate = util.getValue(section, 'status').toLowerCase();
nic.operstate = (operstate === 'active' ? 'up' : (operstate === 'inactive' ? 'down' : 'unknown'));
// nic.operstate = util.getValue(section, 'status').toLowerCase().indexOf('active') > -1 ? 'up' : 'down';
nic.duplex = util.getValue(section, 'media').toLowerCase().indexOf('half-duplex') > -1 ? 'half' : 'full';
if (nic.ip6 || nic.ip4 || nic.mac) {
nics.push(nic);