Skip to content

Commit

Permalink
replace hardcoded batadv vlanid=11 with %N1 template, to allow multip…
Browse files Browse the repository at this point in the history
…le L2 clouds to coexist automatically
  • Loading branch information
altergui committed Sep 2, 2014
1 parent 5a970c5 commit 29b7d78
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion packages/lime-proto-batadv/src/batadv.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,23 @@
local libuci = require("uci")
local fs = require("nixio.fs")
local lan = require("lime.proto.lan")
local utils = require("lime.utils")

batadv = {}

function batadv.setup_interface(ifname, args)
if ifname:match("^wlan%d_ap") then return end
local vlanId = args[2] or 11
local vlanId = args[2] or "%N1"
local vlanProto = args[3] or "8021ad"
local nameSuffix = args[4] or "_batadv"
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)
if not tonumber(vlanId) then vlanId = 16 + utils.applyNetTemplate10(vlanId) end

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

local uci = libuci:cursor()
Expand Down
2 changes: 1 addition & 1 deletion packages/lime-system/files/etc/config/lime-defaults
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ config lime network
list protocols adhoc
list protocols lan
list protocols anygw
list protocols batadv:11
list protocols batadv:%N1 # Parametrizable with %Nn
list protocols bmx6:13
list resolvers 8.8.8.8 # DNS servers node will use
list resolvers 2001:4860:4860::8844
Expand Down

0 comments on commit 29b7d78

Please sign in to comment.