gluon-core: interfaces with forbidden mac are not configured anymore.

This commit is contained in:
lemoer 2016-04-24 19:16:30 +02:00
parent f6592e720c
commit cb6dc47299
3 changed files with 12 additions and 23 deletions

View File

@ -21,13 +21,9 @@ local function configure_client(config, radio, index, suffix)
uci:delete('wireless', name)
if index == 0 then
macaddr = util.generate_mac(0)
elseif index == 1 then
macaddr = util.generate_mac(3)
end
macaddr = util.generate_mac(3*index)
if config then
if config and macaddr then
uci:section('wireless', 'wifi-iface', name,
{
device = radio,

View File

@ -93,11 +93,12 @@ function generate_mac(i)
m1 = nixio.bit.bor(m1, 0x02) -- set locally administered bit
m1 = nixio.bit.band(m1, 0xFE) -- unset the multicast bit
-- It's necessary that the last bits of the mac do
-- not vary on a single interface, since some chips are using
-- It's necessary that the first 45 bits of the mac do
-- not vary on a single hardware interface, since some chips are using
-- a hardware mac filter. (e.g 'ramips-rt305x')
i = i % 0x08 -- max allowed value is 0x07
if i > 7 then return nil end -- max allowed id (0b111)
m6 = nixio.bit.band(m6, 0xF8) -- zero the last three bits (space needed for counting)
m6 = m6 + i -- add virtual interface id

View File

@ -29,7 +29,9 @@ local function configure_ibss(config, radio, index, suffix, disabled)
uci:delete('network', name .. '_vlan')
uci:delete('wireless', name)
if config then
macaddr = util.generate_mac(3*index+2)
if config and macaddr then
if config.vlan then
uci:section('network', 'interface', name,
{
@ -53,12 +55,6 @@ local function configure_ibss(config, radio, index, suffix, disabled)
)
end
if index == 0 then
macaddr = util.generate_mac(2)
elseif index == 1 then
macaddr = util.generate_mac(5)
end
uci:section('wireless', 'wifi-iface', name,
{
device = radio,
@ -83,7 +79,9 @@ local function configure_mesh(config, radio, index, suffix, disabled)
uci:delete('network', name)
uci:delete('wireless', name)
if config then
macaddr = util.generate_mac(3*index+1)
if config and macaddr then
uci:section('network', 'interface', name,
{
proto = 'batadv',
@ -91,12 +89,6 @@ local function configure_mesh(config, radio, index, suffix, disabled)
}
)
if index == 0 then
macaddr = util.generate_mac(1)
elseif index == 1 then
macaddr = util.generate_mac(4)
end
uci:section('wireless', 'wifi-iface', name,
{
device = radio,