gluon-mesh-batman-adv-core: explicitly set primary MAC address using a dummy interface

Fixes #834
This commit is contained in:
Matthias Schiffer 2016-08-31 01:18:10 +02:00
parent 6cddaedfc7
commit d05cee5b55
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
2 changed files with 21 additions and 1 deletions

View File

@ -13,7 +13,7 @@ define Package/gluon-mesh-batman-adv-core
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Support for batman-adv meshing (core)
DEPENDS:=+gluon-core +libgluonutil +gluon-client-bridge +firewall +libiwinfo
DEPENDS:=+gluon-core +libgluonutil +gluon-client-bridge +firewall +libiwinfo +kmod-dummy
endef
define Build/Prepare

View File

@ -15,6 +15,15 @@ if cmd == 'setup' then
local mtu = tonumber(arg[2])
if os.execute('ip link show primary0 >/dev/null 2>&1') ~= 0 then
os.execute([[
ip link add primary0 type dummy
echo 1 > /proc/sys/net/ipv6/conf/primary0/disable_ipv6
ip link set primary0 address ]] .. util.generate_mac(3) .. [[ mtu ]] .. mtu .. [[ up
echo 'bat0' > /sys/class/net/primary0/batman_adv/mesh_iface
]])
end
if fixed_mtu == 0 then
local lower = fs.glob('/sys/class/net/' .. ifname .. '/lower_*/wireless')()
if lower then
@ -41,4 +50,15 @@ elseif cmd == 'teardown' then
file:close()
end
local other = false
for lower in fs.glob('/sys/class/net/bat0/lower_*') do
if lower ~= '/sys/class/net/bat0/lower_primary0' then
other = true
break
end
end
if not other then
os.execute('ip link del primary0')
end
end