Skip to content

Commit

Permalink
added proto-client for specific interface configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ilario committed Nov 10, 2018
1 parent 74093bd commit 2fe1926
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions packages/lime-system/files/usr/lib/lua/lime/proto/client.lua
@@ -0,0 +1,31 @@
#!/usr/bin/lua

local client_mode = require("lime.mode.client")

local client = {}

client.configured = false

function client.configure(args)
client.configured = true
end

function client.setup_interface(ifname, args)
if ifname:match("^wlan%d+."..client_mode.wifi_mode) then
local libuci = require "uci"
local uci = libuci:cursor()

--! sanitize passed ifname for constructing uci section name
--! because only alphanumeric and underscores are allowed
local networkInterfaceName = network.limeIfNamePrefix..ifname:gsub("[^%w_]", "_")

uci:set("network", networkInterfaceName, "interface")
uci:set("network", networkInterfaceName, "proto", "none")
uci:set("network", networkInterfaceName, "mtu", "1536")
uci:set("network", networkInterfaceName, "auto", "1")

uci:save("network")
end
end

return client

0 comments on commit 2fe1926

Please sign in to comment.