From 06ae5eda46ee176573e48330e8e6f9bab57bde4a Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Sun, 23 Jun 2019 20:46:26 +0200 Subject: [PATCH] networtInterfaces() optimized for maxos --- lib/network.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/network.js b/lib/network.js index 00cb28e..23d7ff4 100644 --- a/lib/network.js +++ b/lib/network.js @@ -252,10 +252,10 @@ function parseLinesDarwinNics(sections) { if (line.trim().startsWith('ether ')) { nic.mac = line.split('ether ')[1].toLowerCase().trim(); } - if (line.trim().startsWith('inet6 ')) { - nic.ip6 = line.split('inet6 ')[1].toLowerCase().split('%')[0]; + if (line.trim().startsWith('inet6 ') && !nic.ip6) { + nic.ip6 = line.split('inet6 ')[1].toLowerCase().split('%')[0].split(' ')[0]; } - if (line.trim().startsWith('inet ')) { + if (line.trim().startsWith('inet ') && !nic.ip4) { nic.ip4 = line.split('inet ')[1].toLowerCase().split(' ')[0]; } });