gluon-core: interfaces with forbidden mac are not configured anymore.
This commit is contained in:
parent
f6592e720c
commit
cb6dc47299
@ -21,13 +21,9 @@ local function configure_client(config, radio, index, suffix)
|
|||||||
|
|
||||||
uci:delete('wireless', name)
|
uci:delete('wireless', name)
|
||||||
|
|
||||||
if index == 0 then
|
macaddr = util.generate_mac(3*index)
|
||||||
macaddr = util.generate_mac(0)
|
|
||||||
elseif index == 1 then
|
|
||||||
macaddr = util.generate_mac(3)
|
|
||||||
end
|
|
||||||
|
|
||||||
if config then
|
if config and macaddr then
|
||||||
uci:section('wireless', 'wifi-iface', name,
|
uci:section('wireless', 'wifi-iface', name,
|
||||||
{
|
{
|
||||||
device = radio,
|
device = radio,
|
||||||
|
@ -93,11 +93,12 @@ function generate_mac(i)
|
|||||||
m1 = nixio.bit.bor(m1, 0x02) -- set locally administered bit
|
m1 = nixio.bit.bor(m1, 0x02) -- set locally administered bit
|
||||||
m1 = nixio.bit.band(m1, 0xFE) -- unset the multicast bit
|
m1 = nixio.bit.band(m1, 0xFE) -- unset the multicast bit
|
||||||
|
|
||||||
-- It's necessary that the last bits of the mac do
|
-- It's necessary that the first 45 bits of the mac do
|
||||||
-- not vary on a single interface, since some chips are using
|
-- not vary on a single hardware interface, since some chips are using
|
||||||
-- a hardware mac filter. (e.g 'ramips-rt305x')
|
-- 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 = nixio.bit.band(m6, 0xF8) -- zero the last three bits (space needed for counting)
|
||||||
m6 = m6 + i -- add virtual interface id
|
m6 = m6 + i -- add virtual interface id
|
||||||
|
|
||||||
|
@ -29,7 +29,9 @@ local function configure_ibss(config, radio, index, suffix, disabled)
|
|||||||
uci:delete('network', name .. '_vlan')
|
uci:delete('network', name .. '_vlan')
|
||||||
uci:delete('wireless', name)
|
uci:delete('wireless', name)
|
||||||
|
|
||||||
if config then
|
macaddr = util.generate_mac(3*index+2)
|
||||||
|
|
||||||
|
if config and macaddr then
|
||||||
if config.vlan then
|
if config.vlan then
|
||||||
uci:section('network', 'interface', name,
|
uci:section('network', 'interface', name,
|
||||||
{
|
{
|
||||||
@ -53,12 +55,6 @@ local function configure_ibss(config, radio, index, suffix, disabled)
|
|||||||
)
|
)
|
||||||
end
|
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,
|
uci:section('wireless', 'wifi-iface', name,
|
||||||
{
|
{
|
||||||
device = radio,
|
device = radio,
|
||||||
@ -83,7 +79,9 @@ local function configure_mesh(config, radio, index, suffix, disabled)
|
|||||||
uci:delete('network', name)
|
uci:delete('network', name)
|
||||||
uci:delete('wireless', 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,
|
uci:section('network', 'interface', name,
|
||||||
{
|
{
|
||||||
proto = 'batadv',
|
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,
|
uci:section('wireless', 'wifi-iface', name,
|
||||||
{
|
{
|
||||||
device = radio,
|
device = radio,
|
||||||
|
Loading…
Reference in New Issue
Block a user