Skip to content

Commit

Permalink
Section name cannot contains . use linux_name to store linux interfac…
Browse files Browse the repository at this point in the history
…e name
  • Loading branch information
frank95 committed Aug 9, 2014
1 parent 3815d7a commit ce989ac
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 44 deletions.
20 changes: 11 additions & 9 deletions packages/lime-hwd-tl-wdr3600/src/tl_wdr3600.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,29 @@ function tl_wdr3600.detect_hardware()
config.set("eth0", "net")
config.set("eth0", "autogenerated", "true")
config.set("eth0", "protocols", {"switch"})
config.set("eth0", "linux_name", "eth0")
end

if config.autogenerable("eth0.1") then
if config.autogenerable("eth0vlan1") then
protos = {}
for _, proto in pairs(config.get("network", "protocols")) do
if (proto ~= "wan") then table.insert(protos, proto) end
end
config.set("eth0.1", "net")
config.set("eth0.1", "autogenerated", "true")
config.set("eth0.1", "protocols", protos)

config.set("eth0vlan1", "net")
config.set("eth0vlan1", "autogenerated", "true")
config.set("eth0vlan1", "protocols", protos)
config.set("eth0vlan1", "linux_name", "eth0.1")
end

if config.autogenerable("eth0.2") then
if config.autogenerable("eth0vlan2") then
protos = {}
for _, proto in pairs(config.get("network", "protocols")) do
if (proto ~= "lan") then table.insert(protos, proto) end
end
config.set("eth0.2", "net")
config.set("eth0.2", "autogenerated", "true")
config.set("eth0.2", "protocols", protos)
config.set("eth0vlan2", "net")
config.set("eth0vlan2", "autogenerated", "true")
config.set("eth0vlan2", "protocols", protos)
config.set("eth0vlan2", "linux_name", "eth0.2")
end

config.end_batch()
Expand Down
32 changes: 0 additions & 32 deletions packages/lime-system/files/etc/config/lime
Original file line number Diff line number Diff line change
@@ -1,32 +0,0 @@
# System options
config lime system

# Network general option
# Available protocols: bmx6, batadv, wan, lan, anygw

config lime network
option primary_interface eth0 # The mac address of this device will be used in different places
option bmx6_over_batman false # Disables Bmx6 meshing on top of batman


# WiFi interface specific options ( override general option )

config wifi radio1
list modes 'adhoc'
option channel_2ghz '1'
option channel_5ghz '48'
option adhoc_mcast_rate '6000'
option adhoc_ssid 'libre-mesh'
option adhoc_bssid 'ca:fe:00:c0:ff:ee'

config wifi radio12
list modes 'manual' # If you use manual protocol you must not specify other protocol, or your configuration will be broken!


# Network interface specific options ( override general option )
# Available protocols: bmx6, batadv, wan, lan, manual
# proto:vlan_number works too ( something like bmx6:13 is supported )
# If you use manual do not specify other protocols, may result in an unpredictable behavior/configuration (likely you loose connection to the node)

config net eth5
list protocols 'manual' # If you use manual protocol you must not specify other protocol, or your configuration will be broken!
1 change: 1 addition & 0 deletions packages/lime-system/files/usr/lib/lua/lime/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,5 @@ function config.autogenerable(section_name)
return ( (not config.get_all(section_name)) or config.get_bool(section_name, "autogenerated") )
end


return config
6 changes: 3 additions & 3 deletions packages/lime-system/files/usr/lib/lua/lime/network.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ end
function network.scandevices()
local devices = {}

-- Scan for plain ethernet interfaces
-- Scan for plain ethernet interfaces and switch_vlan interfaces
for _,dev in pairs(utils.split(io.popen("ls -1 /sys/class/net/"):read("*a"), "\n")) do
if dev:match("^eth%d") and not dev:match(network.protoVlanSeparator.."%d$") then
if (dev:match("^eth%d+$") or dev:match("^eth%d+%.%d+$")) and not dev:match(network.protoVlanSeparator.."%d+$") then
table.insert(devices, dev)
end
end
Expand Down Expand Up @@ -121,7 +121,7 @@ function network.configure()
end

local specificIfaces = {}
config.foreach("net", function(iface) specificIfaces[iface[".name"]] = iface end)
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
local fisDevs = network.scandevices()
Expand Down

0 comments on commit ce989ac

Please sign in to comment.