summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2012-05-23 22:22:22 +0000
committerJo-Philipp Wich <jow@openwrt.org>2012-05-23 22:22:22 +0000
commitb3e5467ec6d9782bd2c2fa64869bfab8c54dd8aa (patch)
treee415c99129995eed9cd9d8ed449f09185df2efb8 /modules
parentacde973d829c1579b304a3a8e6b227a8a73ffe27 (diff)
modules/admin-full: check /etc/ethers and /var/dhcp.leases for existence before trying to read them
Diffstat (limited to 'modules')
-rw-r--r--modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua
index 334d9f20f..c502ea802 100644
--- a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua
+++ b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua
@@ -113,14 +113,18 @@ local function arplist(opt)
arp[e["HW address"]:upper()] = { e["IP address"] }
end
- for e in io.lines("/etc/ethers") do
- mac, ip = e:match("^([a-f0-9]%S+) (%S+)")
- if mac and ip then arp[mac:upper()] = { ip } end
+ if fs.access("/etc/ethers") then
+ for e in io.lines("/etc/ethers") do
+ mac, ip = e:match("^([a-f0-9]%S+) (%S+)")
+ if mac and ip then arp[mac:upper()] = { ip } end
+ end
end
- for e in io.lines("/var/dhcp.leases") do
- mac, ip, name = e:match("^%d+ (%S+) (%S+) (%S+)")
- if mac and ip then arp[mac:upper()] = { ip, name ~= "*" and name } end
+ if fs.access("/var/dhcp.leases") then
+ for e in io.lines("/var/dhcp.leases") do
+ mac, ip, name = e:match("^%d+ (%S+) (%S+) (%S+)")
+ if mac and ip then arp[mac:upper()] = { ip, name ~= "*" and name } end
+ end
end
for mac, e in luci.util.kspairs(arp) do