Skip to content

Commit

Permalink
added eigennet legacy compatibility proto
Browse files Browse the repository at this point in the history
  • Loading branch information
G10h4ck committed Jun 9, 2014
1 parent 0b9133a commit dbfdfc8
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/lime-proto-batadv/src/batadv.lua
Expand Up @@ -7,12 +7,14 @@ local lan = require("lime.proto.lan")
batadv = {}

function batadv.setup_interface(ifname, args)
if not args[2] then return end

local owrtInterfaceName, _, owrtDeviceName = network.createVlanIface(ifname, args[2], "_batadv")
local vlanId = args[2] or 11
local vlanProto = args[3] or "8021ad"
local nameSuffix = args[4] or "_batadv"
local mtu = 1532
if ifname:match("^eth") then mtu = 1496 end

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

local uci = libuci:cursor()

uci:set("network", owrtDeviceName, "mtu", mtu)
Expand Down
39 changes: 39 additions & 0 deletions packages/lime-proto-eigennet/Makefile
@@ -0,0 +1,39 @@
#
# Copyright (C) 2006-2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v3.
#

include $(TOPDIR)/rules.mk

LIME_BUILDDATE:=$(shell date +%Y%m%d_%H%M)
LIME_CODENAME:=bigbang

GIT_COMMIT_DATE:=$(shell git log -n 1 --pretty=%ad --date=short . )
GIT_COMMIT_TSTAMP:=$(shell git log -n 1 --pretty=%at . )

PKG_NAME:=lime-proto-eigennet
PKG_VERSION=$(GIT_COMMIT_DATE)-$(GIT_COMMIT_TSTAMP)

include $(INCLUDE_DIR)/package.mk

define Package/$(PKG_NAME)
TITLE:=LiMe eigennet legacy compatibility proto support
CATEGORY:=LiMe
MAINTAINER:=Gioacchino Mazzurco <gio@eigenlab.org>
URL:=http://libre-mesh.org
DEPENDS:=+lua +libuci-lua +lime-system +lime-proto-batadv
endef

define Build/Compile
@rm -rf ./build || true
@cp -r ./src ./build
@sed -i '/^--!.*/d' build/*.lua
endef

define Package/$(PKG_NAME)/install
@mkdir -p $(1)/usr/lib/lua/lime/proto || true
$(CP) ./build/eigennet.lua $(1)/usr/lib/lua/lime/proto/
endef

$(eval $(call BuildPackage,$(PKG_NAME)))
45 changes: 45 additions & 0 deletions packages/lime-proto-eigennet/src/eigennet.lua
@@ -0,0 +1,45 @@
#!/usr/bin/lua

local network = require("lime.network")
local batadv = require("lime.proto.batadv")
local libuci = require("uci")

eigennet = {}

function eigennet.setup_interface(ifname, args)
if ifname:match("^wlan%d_ap") then return end

if ifname:match("^eth%d$") then
args[2] = args[2] or 10
args[3] = args[3] or "8021q"
args[4] = args[4] or "_eigennet"

batadv.setup_interface(ifname, args)
return
end

if ifname:match("^wlan%d_adhoc$") then
local owrtInterfaceName = network.limeIfNamePrefix..ifname

local uci = libuci:cursor()

uci:set("network", owrtInterfaceName, "interface")
uci:set("network", owrtInterfaceName, "mtu", 1532)
uci:set("network", owrtInterfaceName, "proto", "batadv")
uci:set("network", owrtInterfaceName, "mesh", "bat0")
uci:set("network", owrtInterfaceName, "eigennet", "1")

uci:save("network")
end
end

function eigennet.clean()
batadv.clean()
end

function eigennet.configure(args)
batadv.configure(args)
end


return eigennet

1 comment on commit dbfdfc8

@ilario
Copy link
Member

@ilario ilario commented on dbfdfc8 Jun 10, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah

Please sign in to comment.