Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wifi client mode in backbone via BMX6 #426

Merged
merged 3 commits into from Jan 27, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -106,17 +106,30 @@ config wifi radio3 # you should ensure that the chosen radio name exists, for ex
# you need two pieces of configuration the wifi specific configuration and the
# network specific one like in the following example.

## set radio4 as client of access point, both the following "wifi" and "net" sections are required
## set radio4 as client of access point for internet access, both the following "wifi" and "net" sections are required
option wifi radio4 # you should ensure that the chosen radio name exists, for example with "wifi status" command
list modes 'client'
option channel_2ghz 'auto'
option client_ssid 'SomeWiFiNetwork'
option client_key 'SomeWPApskPassword'
option client_encryption 'psk' # psk for WPA or psk2 for WPA2
option distance 300 # maximum distance to AP, heavily affects performances

config net wirelessclient
config net wirelessclientWAN
option linux_name 'wlan0-sta' # the client interface name could be named differently, like wlan1-sta
list protocols 'wan' # use wan to get Internet connectivity via DHCP, lan is not supported yet
list protocols 'wan' # use wan to get Internet connectivity via DHCP

## set radio5 as client of an access point part of the LibreMesh network, both the following "wifi" and "net" sections are required
option wifi radio5 # you should ensure that the chosen radio name exists, for example with "wifi status" command
list modes 'client'
option channel_2ghz 'auto'
option client_ssid 'LibreMesh.org'
option distance 1000 # maximum distance to AP, heavily affects performances

config net wirelessclientBackbone
option linux_name 'wlan0-sta' # the client interface name could be named differently, like wlan1-sta
list protocols 'client' # needed for setting up the new interface
list protocols 'bmx6:0' # use BMX6 routing on client interface. The :0 is needed for disabling the VLAN, as the AP usually does not have VLAN. In case VLAN is needed, it has to be set also as specific AP configuration, not implemented. LAN is not supported by wireless drivers. BATMAN-adv would need specific AP configuration, not implemented. Having both BMX6 and BATMAN-adv is hindered by the fact that BMX6 sets the proto of the interface as static.

### Network interface specific options ( override general option )
### Available protocols: bmx6, bmx7, batadv, olsr, olsr6, olsr2, bgp, wan, lan, manual, static
@@ -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
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.