gluon-core: drop IBSS support

This commit is contained in:
Matthias Schiffer 2019-11-05 20:46:19 +01:00
parent 2fdb3080ce
commit 066158a27b
3 changed files with 8 additions and 67 deletions

View File

@ -49,14 +49,7 @@ for _, config in ipairs({'wifi24', 'wifi5'}) do
obsolete({config, 'supported_rates'}, '802.11b rates are disabled by default.')
obsolete({config, 'basic_rate'}, '802.11b rates are disabled by default.')
if need_table({config, 'ibss'}, nil, false) then
need_string_match(in_domain({config, 'ibss', 'ssid'}), '^' .. ('.?'):rep(32) .. '$')
need_string_match(in_domain({config, 'ibss', 'bssid'}), '^%x[02468aAcCeE]:%x%x:%x%x:%x%x:%x%x:%x%x$')
need_one_of({config, 'ibss', 'mcast_rate'}, supported_rates, false)
need_number({config, 'ibss', 'vlan'}, false)
need_boolean({config, 'ibss', 'disabled'}, false)
end
obsolete({config, 'ibss'}, 'IBSS support has been dropped.')
if need_table({config, 'mesh'}, nil, false) then
need_string_match(in_domain({config, 'mesh', 'id'}), '^' .. ('.?'):rep(32) .. '$')

View File

@ -98,49 +98,12 @@ local function first_non_nil(first, ...)
end
local function configure_ibss(config, radio, index, suffix, disabled)
local radio_name = radio['.name']
local function delete_ibss(radio_name)
local name = 'ibss_' .. radio_name
uci:delete('network', name)
uci:delete('network', name .. '_vlan')
uci:delete('wireless', name)
if not config then
return
end
local macaddr = util.get_wlan_mac(uci, radio, index, 3)
if not macaddr then
return
end
if config.vlan then
uci:section('network', 'interface', name, {
proto = 'none',
})
uci:section('network', 'interface', name .. '_vlan', {
ifname = '@' .. name .. '.' .. config.vlan,
proto = 'gluon_mesh',
})
else
uci:section('network', 'interface', name, {
proto = 'gluon_mesh',
})
end
uci:section('wireless', 'wifi-iface', name, {
device = radio_name,
network = name,
mode = 'adhoc',
ssid = config.ssid,
bssid = config.bssid,
macaddr = macaddr,
mcast_rate = config.mcast_rate,
ifname = suffix and 'ibss' .. suffix,
disabled = disabled,
})
end
local function configure_mesh(config, radio, index, suffix, disabled)
@ -202,20 +165,9 @@ local function configure_mesh_wireless(radio, index, config)
local radio_name = radio['.name']
local suffix = radio_name:match('^radio(%d+)$')
local ibss_disabled = is_disabled('ibss_' .. radio_name)
local mesh_disabled = is_disabled('mesh_' .. radio_name)
configure_ibss(config.ibss(), radio, index, suffix,
first_non_nil(
ibss_disabled,
mesh_disabled,
config.ibss.disabled(false)
)
)
configure_mesh(config.mesh(), radio, index, suffix,
first_non_nil(
mesh_disabled,
ibss_disabled,
is_disabled('mesh_' .. radio_name),
config.mesh.disabled(false)
)
)
@ -224,6 +176,8 @@ end
util.foreach_radio(uci, function(radio, index, config)
local radio_name = radio['.name']
delete_ibss(radio_name)
if not config() then
uci:set('wireless', radio_name, 'disabled', true)
return
@ -259,7 +213,6 @@ util.foreach_radio(uci, function(radio, index, config)
util.add_to_set(hostapd_options, 'country3=0x4f')
uci:set_list('wireless', radio_name, 'hostapd_options', hostapd_options)
uci:delete('wireless', 'ibss_' .. radio_name)
uci:delete('wireless', 'mesh_' .. radio_name)
else
uci:delete('wireless', radio_name, 'channels')
@ -277,12 +230,7 @@ end)
if uci:get('system', 'rssid_wlan0') then
if uci:get('wireless', 'mesh_radio0') then
uci:set('system', 'rssid_wlan0', 'dev', 'mesh0')
else
uci:set('system', 'rssid_wlan0', 'dev', 'ibss0')
end
uci:save('system')
end

View File

@ -172,11 +172,11 @@ end
-- IDs defined so far:
-- 0: client0; WAN
-- 1: mesh0
-- 2: ibss0
-- 2: (unused)
-- 3: wan_radio0 (private WLAN); batman-adv primary address
-- 4: client1; LAN
-- 5: mesh1
-- 6: ibss1
-- 6: (unused)
-- 7: wan_radio1 (private WLAN); mesh VPN
function M.generate_mac(i)
if i > 7 or i < 0 then return nil end -- max allowed id (0b111)