netforkInterfaces() node 18 compatibility

This commit is contained in:
Sebastian Hildebrandt
2022-04-22 07:14:54 +02:00
parent 66b8620243
commit 1a930c9682
4 changed files with 14 additions and 8 deletions
+6 -6
View File
@@ -743,10 +743,10 @@ function networkInterfaces(callback, rescan, defaultString) {
if ({}.hasOwnProperty.call(ifaces, nic.iface)) {
ifaces[nic.iface].forEach(function (details) {
if (details.family === 'IPv4') {
if (details.family === 'IPv4' || details.family === 4) {
nic.ip4subnet = details.netmask;
}
if (details.family === 'IPv6') {
if (details.family === 'IPv6' || details.family === 6) {
nic.ip6subnet = details.netmask;
}
});
@@ -818,11 +818,11 @@ function networkInterfaces(callback, rescan, defaultString) {
if ({}.hasOwnProperty.call(ifaces, dev)) {
let ifaceName = dev;
ifaces[dev].forEach(function (details) {
if (details.family === 'IPv4') {
if (details.family === 'IPv4' || details.family === 4) {
ip4 = details.address;
ip4subnet = details.netmask;
}
if (details.family === 'IPv6') {
if (details.family === 'IPv6' || details.family === 6) {
if (!ip6 || ip6.match(/^fe80::/i)) {
ip6 = details.address;
ip6subnet = details.netmask;
@@ -984,11 +984,11 @@ function networkInterfaces(callback, rescan, defaultString) {
if ({}.hasOwnProperty.call(ifaces, dev)) {
let ifaceName = dev;
ifaces[dev].forEach(function (details) {
if (details.family === 'IPv4') {
if (details.family === 'IPv4' || details.family === 4) {
ip4 = details.address;
ip4subnet = details.netmask;
}
if (details.family === 'IPv6') {
if (details.family === 'IPv6' || details.family === 6) {
if (!ip6 || ip6.match(/^fe80::/i)) {
ip6 = details.address;
ip6subnet = details.netmask;