applications/luci-wol: cope with host entries that have multiple MACs assigned
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 21 Jul 2011 15:26:55 +0000 (15:26 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 21 Jul 2011 15:26:55 +0000 (15:26 +0000)
applications/luci-wol/luasrc/model/cbi/wol.lua

index 30467f4..ad3479b 100644 (file)
@@ -72,7 +72,14 @@ end
 uci:foreach("dhcp", "host",
        function(s)
                if s.mac and s.ip then
-                       arp[s.mac:upper()] = { s.ip, s.name }
+                       if type(s.mac) == "table" then
+                               local m
+                               for _, m in ipairs(s.mac) do
+                                       arp[m:upper()] = { s.ip, s.name }
+                               end
+                       else
+                               arp[s.mac:upper()] = { s.ip, s.name }
+                       end
                end
        end)