Skip to content

Commit

Permalink
Removed workaround for iussue #32
Browse files Browse the repository at this point in the history
  • Loading branch information
G10h4ck committed Nov 9, 2014
1 parent fa363eb commit 29703e4
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions packages/lime-proto-batadv/src/batadv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,17 @@ function batadv.setup_interface(ifname, args)
local mtu = 1532
if ifname:match("^eth") then mtu = 1496 end

-- Unless a specific integer is passed, parse network_id (%N1) template
-- and use that number + 16 to get a vlanId between 16 and 271 for batadv
-- (to avoid overlapping with other protocols)
--! Unless a specific integer is passed, parse network_id (%N1) template
--! and use that number + 16 to get a vlanId between 16 and 271 for batadv
--! (to avoid overlapping with other protocols)
if not tonumber(vlanId) then vlanId = 16 + utils.applyNetTemplate10(vlanId) end

local owrtInterfaceName, _, owrtDeviceName = network.createVlanIface(ifname, vlanId, nameSuffix, vlanProto)

local uci = libuci:cursor()

uci:set("network", owrtDeviceName, "mtu", mtu)

-- BEGIN
-- Workaround to http://www.libre-mesh.org/issues/32
-- We create a new macaddress for ethernet vlan interface
-- We change the 7nt bit to 1 to give it locally administered meaning
-- Then use it as the new mac address prefix "02"
local vlanMacAddr = nil
if ifname:match("^eth") then
vlanMacAddr = network.get_mac(ifname)
elseif ifname:match("^wlan%d+"..wireless.ifnameModeSeparator.."ap") then
vlanMacAddr = wireless.get_phy_mac("phy"..ifname:match("%d+"))
end
if vlanMacAddr then
vlanMacAddr[1] = "02"
uci:set("network", owrtDeviceName, "macaddr", table.concat(vlanMacAddr, ":"))
end
--- END

uci:set("network", owrtInterfaceName, "proto", "batadv")
uci:set("network", owrtInterfaceName, "mesh", "bat0")

uci:save("network")
end

Expand Down

0 comments on commit 29703e4

Please sign in to comment.