gluon-core: use OpenWrt label-mac as fallback (#2170)
This adds the OpenWrt label-mac device selection as the most preferred fallback. While this is only used on OpenWrt 19.07 for backports, we can also use the label-mac device when backporting device support. This way, we have to deal with less device-sepcific code downstream. Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
parent
7320603a1f
commit
fd3ecea953
5
package/gluon-core/files/lib/gluon/label_mac.sh
Executable file
5
package/gluon-core/files/lib/gluon/label_mac.sh
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /lib/functions/system.sh
|
||||||
|
|
||||||
|
get_mac_label
|
@ -54,6 +54,19 @@ local function interface(name)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function label_mac()
|
||||||
|
return function()
|
||||||
|
local mac = util.exec('/lib/gluon/label_mac.sh')
|
||||||
|
|
||||||
|
if mac == nil then return nil end
|
||||||
|
|
||||||
|
mac = util.trim(mac)
|
||||||
|
if string.len(mac) ~= 17 then return nil end
|
||||||
|
|
||||||
|
return mac
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Entries are matched in the order they are listed
|
-- Entries are matched in the order they are listed
|
||||||
local primary_addrs = {
|
local primary_addrs = {
|
||||||
@ -148,6 +161,10 @@ local primary_addrs = {
|
|||||||
'dir-860l-b1',
|
'dir-860l-b1',
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
|
-- label-mac-device default
|
||||||
|
{label_mac(), {
|
||||||
|
{}, -- matches everything
|
||||||
|
}},
|
||||||
-- phy0 default
|
-- phy0 default
|
||||||
{phy(0), {
|
{phy(0), {
|
||||||
{}, -- matches everything
|
{}, -- matches everything
|
||||||
|
Loading…
Reference in New Issue
Block a user