Added netif2 to meshctrl displayinfo
Noah Zalev committed
Jul 12, 2021 at 17:23 UTC
3e0fb41524ea0e12851ffe7b1e711b93c5c90e66
1 file changed
+61
meshctrl.js
+61
@@ -2337,6 +2337,67 @@ function displayDeviceInfo(sysinfo, lastconnect, network, nodes) {
2337
}
2338
}
2339
2340
+ if (network.netif2 != null) {
2341
+ var minfo = {};
2342
+ for (var i in network.netif2) {
2343
+ var m = network.netif2[i], moutput = {}, moutputCount = 0;
2344
+
2345
+ if (Array.isArray(m) == false ||
2346
+ m.length < 1 ||
2347
+ m[0] == null ||
2348
+ ((typeof m[0].mac == 'string') && (m[0].mac.startsWith('00:00:00:00')))
2349
+ )
2350
+ continue;
2351
+
2352
+ var ifTitle = '';
2353
+ if (i != null) ifTitle += i;
2354
+ if (m[0].fqdn != null && m[0].fqdn != '') ifTitle += ', ' + m[0].fqdn;
2355
+
2356
+ if (typeof m[0].mac == 'string') {
2357
+ if (m[0].gatewaymac) {
2358
+ moutput['MAC Layer'] = format("MAC: {0}, Gateway: {1}", m[0].mac, m[0].gatewaymac);
2359
+ } else {
2360
+ moutput['MAC Layer'] = format("MAC: {0}", m[0].mac);
2361
+ }
2362
+ moutputCount++;
2363
+ }
2364
+
2365
+ moutput['IPv4 Layer'] = '';
2366
+ moutput['IPv6 Layer'] = '';
2367
+ for (var j = 0; j < m.length; j++) {
2368
+ var iplayer = m[j];
2369
+ if (iplayer.family == 'IPv4') {
2370
+ if (iplayer.gateway && iplayer.netmask) {
2371
+ moutput['IPv4 Layer'] += format("IP: {0}, Mask: {1}, Gateway: {2} ", iplayer.address, iplayer.netmask, iplayer.gateway);
2372
+ moutputCount++;
2373
+ } else {
2374
+ if (iplayer.address) {
2375
+ moutput['IPv4 Layer'] += format("IP: {0} ", iplayer.address);
2376
+ moutputCount++;
2377
+ }
2378
+ }
2379
+ }
2380
+ if (iplayer.family == 'IPv6') {
2381
+ if (iplayer.gateway && iplayer.netmask) {
2382
+ moutput['IPv6 Layer'] += format("IP: {0}, Mask: {1}, Gateway: {2} ", iplayer.address, iplayer.netmask, iplayer.gateway);
2383
+ moutputCount++;
2384
+ } else {
2385
+ if (iplayer.address) {
2386
+ moutput['IPv6 Layer'] += format("IP: {0} ", iplayer.address);
2387
+ moutputCount++;
2388
+ }
2389
+ }
2390
+ }
2391
+ }
2392
+ if (moutput['IPv4 Layer'] == '') delete moutput['IPv4 Layer'];
2393
+ if (moutput['IPv6 Layer'] == '') delete moutput['IPv6 Layer'];
2394
+ if (moutputCount > 0) {
2395
+ minfo[ifTitle] = moutput;
2396
+ info["Networking"] = minfo;
2397
+ }
2398
+ }
2399
+ }
2400
+
2401
// Intel AMT
2402
if (node.intelamt != null) {
2403
var output = {}, outputCount = 0;