Skip to content

Commit

Permalink
lime-system: network.clean() clean network.wan.ifname
Browse files Browse the repository at this point in the history
  • Loading branch information
frank95 committed Aug 11, 2014
1 parent 80bafcc commit 73e2ac5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/lime-system/files/usr/lib/lua/lime/network.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ function network.clean()
local uci = libuci:cursor()

uci:delete("network", "globals", "ula_prefix")
uci:delete("network", "wan", "ifname")

-- Delete interfaces and devices generated by LiMe
--! Delete interfaces and devices generated by LiMe
uci:foreach("network", "interface", function(s) if utils.stringStarts( s[".name"], network.limeIfNamePrefix ) then uci:delete("network", s[".name"]) end end)
uci:foreach("network", "device", function(s) if utils.stringStarts( s[".name"], network.limeIfNamePrefix ) then uci:delete("network", s[".name"]) end end)
uci:save("network")
Expand All @@ -90,7 +91,7 @@ end
function network.scandevices()
local devices = {}

-- Scan for plain ethernet interfaces and switch_vlan interfaces
--! Scan for plain ethernet interfaces and switch_vlan interfaces
local stdOut = io.popen("ls -1 /sys/class/net/")
for dev in stdOut:lines() do
if (dev:match("^eth%d+$") or dev:match("^eth%d+%.%d+$")) then
Expand All @@ -99,7 +100,7 @@ function network.scandevices()
end
stdOut:close()

-- Scan for plain wireless interfaces
--! Scan for plain wireless interfaces
local uci = libuci:cursor()
uci:foreach("wireless", "wifi-iface", function(s) table.insert(devices, s["ifname"]) end)

Expand All @@ -124,7 +125,7 @@ function network.configure()
local specificIfaces = {}
config.foreach("net", function(iface) specificIfaces[iface["linux_name"]] = iface end)

-- Scan for fisical devices, if there is a specific config apply that otherwise apply general config
--! Scan for fisical devices, if there is a specific config apply that otherwise apply general config
local fisDevs = network.scandevices()
for _,device in pairs(fisDevs) do
local owrtIf = specificIfaces[device]
Expand Down

0 comments on commit 73e2ac5

Please sign in to comment.