diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2370574..70712dc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,8 @@ For major (breaking) changes - version 3 and 2 see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
+| 4.0.2 | 2019-02-03 | `networkInterfaces(), chassis()` fixed smaller issues |
+| 4.0.1 | 2019-02-02 | updated docs |
| 4.0.0 | 2019-02-02 | new major version |
| 3.54.0 | 2018-12-30 | added TypeScript type definitions |
| 3.53.1 | 2018-12-29 | `versions()` bug fix nginx version |
diff --git a/README.md b/README.md
index 00d3c56..14f1033 100644
--- a/README.md
+++ b/README.md
@@ -80,7 +80,7 @@ You can find all changes here: [detailed changelog][changelog-url]
[Node.js][nodejs-url] comes with some basic OS information, but I always wanted a little more. So I came up to write this little library. This library is still work in progress. It is supposed to be used as a backend/server-side library (will definilely not work within a browser). It requires node.js version 4.0 and above.
-I was able to test it on several Debian, Raspbian, Ubuntu distributions as well as macOS (Mavericks, Yosemite, El Captain, Sierra, High Sierra) and some Windows 7, Windows 10, FreeBSD and SunOS machines. Not all functions are supported on all operating systems. Have a look at the function reference in the docs to get further details.
+I was able to test it on several Debian, Raspbian, Ubuntu distributions as well as macOS (Mavericks, Yosemite, El Captain, Sierra, High Sierra, Mojave) and some Windows 7, Windows 10, FreeBSD and SunOS machines. Not all functions are supported on all operating systems. Have a look at the function reference in the docs to get further details.
If you have comments, suggestions & reports, please feel free to contact me!
diff --git a/docs/history.html b/docs/history.html
index b6cb089..e60ec9c 100644
--- a/docs/history.html
+++ b/docs/history.html
@@ -55,6 +55,21 @@
+
+ | 4.0.2 |
+ 2019-02-03 |
+ networkInterfaces(), chassis() fixed smaller issues |
+
+
+ | 4.0.1 |
+ 2019-02-02 |
+ updated docs |
+
+
+ | 4.0.0 |
+ 2019-02-02 |
+ new major version 4 |
+
| 3.54.0 |
2018-12-30 |
diff --git a/lib/network.js b/lib/network.js
index 126f9d8..e4260a7 100644
--- a/lib/network.js
+++ b/lib/network.js
@@ -311,7 +311,7 @@ function networkInterfaces(callback) {
}
});
if (_linux) {
- let iface = dev.split(':')[0];
+ let iface = dev.split(':')[0].trim().toLowerCase();
const cmd = `echo -n "addr_assign_type: "; cat /sys/class/net/${iface}/addr_assign_type 2>/dev/null; echo;
echo -n "address: "; cat /sys/class/net/${iface}/address 2>/dev/null; echo;
echo -n "addr_len: "; cat /sys/class/net/${iface}/addr_len 2>/dev/null; echo;
@@ -335,7 +335,7 @@ function networkInterfaces(callback) {
echo -n "speed: "; cat /sys/class/net/${iface}/speed 2>/dev/null; echo;
echo -n "tx_queue_len: "; cat /sys/class/net/${iface}/tx_queue_len 2>/dev/null; echo;
echo -n "type: "; cat /sys/class/net/${iface}/type 2>/dev/null; echo;
- echo -n "wireless: "; cat /proc/net/wireless \| grep ${iface};
+ echo -n "wireless: "; cat /proc/net/wireless 2>/dev/null \| grep ${iface};
echo -n "wirelessspeed: "; iw dev ${iface} link 2>&1 \| grep bitrate; echo;`;
let lines = [];
try {
@@ -356,6 +356,7 @@ function networkInterfaces(callback) {
carrierChanges = parseInt(util.getValue(lines, 'carrier_changes'), 10);
operstate = util.getValue(lines, 'operstate');
type = operstate === 'up' ? (util.getValue(lines, 'wireless').trim() ? 'wireless' : 'wired') : 'unknown';
+ if (iface === 'lo' || iface.startsWith('bond')) { type = 'virtual'; }
// rx_bytes = parseInt(util.getValue(lines, 'rx_bytes'), 10);
// rx_dropped = parseInt(util.getValue(lines, 'rx_dropped'), 10);
// rx_errors = parseInt(util.getValue(lines, 'rx_errors'), 10);
diff --git a/lib/system.js b/lib/system.js
index 3ece980..5ff13ce 100644
--- a/lib/system.js
+++ b/lib/system.js
@@ -532,7 +532,7 @@ function chassis(callback) {
result.manufacturer = util.getValue(lines, 'manufacturer', '=');
result.model = util.getValue(lines, 'model', '=');
const ctype = parseInt(util.getValue(lines, 'ChassisTypes', '=').replace(/\D/g, ''));
- result.type = (ctype && !isNaN(ctype) && ctype < chassisTypes.length) ? chassisTypes[ctype] : '';
+ result.type = (ctype && !isNaN(ctype) && ctype < chassisTypes.length) ? chassisTypes[ctype - 1] : '';
result.version = util.getValue(lines, 'version', '=');
result.serial = util.getValue(lines, 'serialnumber', '=');
result.assetTag = util.getValue(lines, 'partnumber', '=');