luci-base: network.js: filter invalid mac addresses
authorJo-Philipp Wich <jo@mein.io>
Wed, 18 Sep 2019 05:46:33 +0000 (07:46 +0200)
committerJo-Philipp Wich <jo@mein.io>
Wed, 18 Sep 2019 05:46:33 +0000 (07:46 +0200)
Only consider valid ethernet mac addresses when building the device state
from raw getifaddrs() information.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/network.js

index c3c20304e5ef0da63140b448f8d9f4cdf6d3b199..d0282ad01f11503edd0022b06a88bd53d650b96a 100644 (file)
@@ -463,7 +463,9 @@ function initNetworkState(refresh) {
                                        if (a.family == 'packet') {
                                                s.netdevs[name].flags   = a.flags;
                                                s.netdevs[name].stats   = a.data;
-                                               s.netdevs[name].macaddr = a.addr;
+
+                                               if (a.addr != null && a.addr != '00:00:00:00:00:00' && a.addr.length == 17)
+                                                       s.netdevs[name].macaddr = a.addr;
                                        }
                                        else if (a.family == 'inet') {
                                                s.netdevs[name].ipaddrs.push(a.addr + '/' + a.netmask);