--- /dev/null
+#
+# Copyright (C) 2008 Freifunk Leipzig
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id$
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=olsrd-luci
+PKG_VERSION:=0.5.6-rc7
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://www.olsr.org/releases/0.5
+PKG_MD5SUM:=10fbf796792d51eda735d171b6c86941
+
+include $(INCLUDE_DIR)/package.mk
+
+
+define Package/olsrd-luci/common_info
+ SECTION:=net
+ CATEGORY:=Network
+ TITLE:=OLSR - Optimized Link State Routing Daemon
+ URL:=http://www.olsr.org/
+ MAINTAINER:=Jo-Philipp Wich <xm@leipzig.freifunk.net>
+endef
+
+define Package/olsrd-luci
+ $(call Package/olsrd-luci/common_info)
+ MENU:=1
+ DEPENDS:=+libpthread
+endef
+
+define Package/olsrd-luci-mod-arprefresh
+ $(call Package/olsrd-luci/common_info)
+ MENU:=1
+ TITLE:=OLSR - ARP Refresh Plugin
+ DEPENDS:=olsrd-luci
+endef
+
+define Package/olsrd-luci-mod-dot-draw
+ $(call Package/olsrd-luci/common_info)
+ MENU:=1
+ TITLE:=OLSR - Dot Draw Plugin
+ DEPENDS:=olsrd-luci
+endef
+
+define Package/olsrd-luci-mod-bmf
+ $(call Package/olsrd-luci/common_info)
+ MENU:=1
+ TITLE:=OLSR - Basic Multicast Forwarding Plugin
+ DEPENDS:=olsrd-luci +kmod-tun
+endef
+
+define Package/olsrd-luci-mod-dyn-gw
+ $(call Package/olsrd-luci/common_info)
+ MENU:=1
+ TITLE:=OLSR - Dynamic Gateway Plugin
+ DEPENDS:=olsrd-luci
+endef
+
+define Package/olsrd-luci-mod-dyn-gw-plain
+ $(call Package/olsrd-luci/common_info)
+ MENU:=1
+ TITLE:=OLSR - Dynamic Gateway Plugin (Plain Version)
+ DEPENDS:=olsrd-luci
+endef
+
+define Package/olsrd-luci-mod-httpinfo
+ $(call Package/olsrd-luci/common_info)
+ MENU:=1
+ TITLE:=OLSR - HTTP/HTML Info Plugin
+ DEPENDS:=olsrd-luci
+endef
+
+define Package/olsrd-luci-mod-nameservice
+ $(call Package/olsrd-luci/common_info)
+ MENU:=1
+ TITLE:=OLSR - Hostname Propagation Plugin
+ DEPENDS:=olsrd-luci
+endef
+
+define Package/olsrd-luci-mod-secure
+ $(call Package/olsrd-luci/common_info)
+ MENU:=1
+ TITLE:=OLSR - Security Extensions Plugin
+ DEPENDS:=olsrd-luci
+endef
+
+define Package/olsrd-luci-mod-txtinfo
+ $(call Package/olsrd-luci/common_info)
+ MENU:=1
+ TITLE:=OLSR - HTTP/Plaintext Info Plugin
+ DEPENDS:=olsrd-luci
+endef
+
+define Package/olsrd-luci-mod-pgraph
+ $(call Package/olsrd-luci/common_info)
+ MENU:=1
+ TITLE:=OLSR - PGraph Plugin
+ DEPENDS:=olsrd-luci
+endef
+
+define Package/olsrd-luci-mod-quagga
+ $(call Package/olsrd-luci/common_info)
+ MENU:=1
+ TITLE:=OLSR - Quagga Plugin
+ DEPENDS:=olsrd-luci
+endef
+
+define Package/olsrd-luci-mod-tas
+ $(call Package/olsrd-luci/common_info)
+ MENU:=1
+ TITLE:=OLSR - Tiny Application Server Plugin
+ DEPENDS:=olsrd-luci
+endef
+
+define Build/Compile
+ $(MAKE) -C "$(PKG_BUILD_DIR)" olsrd-luci libs \
+ $(TARGET_CONFIGURE_OPTS) \
+ NODEBUG=1 \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ OS="linux" \
+ INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
+ LIBDIR="$(PKG_INSTALL_DIR)/usr/lib" \
+ SBINDIR="$(PKG_INSTALL_DIR)/usr/sbin/" \
+ ETCDIR="$(PKG_INSTALL_DIR)/etc" \
+ MANDIR="$(PKG_INSTALL_DIR)/usr/share/man" \
+ STRIP="true" \
+ INSTALL_LIB="true" \
+ SUBDIRS="arprefresh bmf dot_draw dyn_gw dyn_gw_plain httpinfo nameservice secure txtinfo pgraph quagga tas"
+endef
+
+define Package/olsrd-luci/install
+ $(INSTALL_DIR) $(1)/usr/sbin
+ $(INSTALL_DIR) $(1)/lib/config
+ $(INSTALL_DIR) $(1)/etc/config
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/olsrd-luci $(1)/usr/sbin/
+ $(INSTALL_BIN) ./files/etc/init.d/olsrd-luci $(1)/etc/init.d/
+ $(INSTALL_CONF) ./files/etc/config/olsr $(1)/etc/config/
+ $(INSTALL_DATA) ./files/lib/config/olsr.lua $(1)/lib/config/
+endef
+
+define Package/olsrd-luci-mod-arprefresh/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/lib/arprefresh/olsrd-luci_arprefresh.so.* $(1)/usr/lib/
+endef
+
+define Package/olsrd-luci-mod-dot-draw/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/lib/dot_draw/olsrd-luci_dot_draw.so.* $(1)/usr/lib/
+endef
+
+define Package/olsrd-luci-mod-bmf/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/lib/bmf/olsrd-luci_bmf.so.* $(1)/usr/lib/
+endef
+
+define Package/olsrd-luci-mod-dyn-gw/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/lib/dyn_gw/olsrd-luci_dyn_gw.so.* $(1)/usr/lib/
+endef
+
+define Package/olsrd-luci-mod-dyn-gw-plain/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/lib/dyn_gw_plain/olsrd-luci_dyn_gw_plain.so.* $(1)/usr/lib/
+endef
+
+define Package/olsrd-luci-mod-httpinfo/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/lib/httpinfo/olsrd-luci_httpinfo.so.* $(1)/usr/lib/
+endef
+
+define Package/olsrd-luci-mod-nameservice/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/lib/nameservice/olsrd-luci_nameservice.so.* $(1)/usr/lib/
+endef
+
+define Package/olsrd-luci-mod-secure/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/lib/secure/olsrd-luci_secure.so.* $(1)/usr/lib/
+endef
+
+define Package/olsrd-luci-mod-txtinfo/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/lib/txtinfo/olsrd-luci_txtinfo.so.* $(1)/usr/lib/
+endef
+
+define Package/olsrd-luci-mod-pgraph/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/lib/pgraph/olsrd-luci_pgraph.so.* $(1)/usr/lib/
+endef
+
+define Package/olsrd-luci-mod-quagga/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/lib/quagga/olsrd-luci_quagga.so.* $(1)/usr/lib/
+endef
+
+define Package/olsrd-luci-mod-tas/install
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/lib/tas/olsrd-luci_tas.so.* $(1)/usr/lib/
+endef
+
+
+$(eval $(call BuildPackage,olsrd-luci))
+$(eval $(call BuildPackage,olsrd-luci-mod-arprefresh))
+$(eval $(call BuildPackage,olsrd-luci-mod-dot-draw))
+$(eval $(call BuildPackage,olsrd-luci-mod-bmf))
+$(eval $(call BuildPackage,olsrd-luci-mod-dyn-gw))
+$(eval $(call BuildPackage,olsrd-luci-mod-dyn-gw-plain))
+$(eval $(call BuildPackage,olsrd-luci-mod-httpinfo))
+$(eval $(call BuildPackage,olsrd-luci-mod-nameservice))
+$(eval $(call BuildPackage,olsrd-luci-mod-secure))
+$(eval $(call BuildPackage,olsrd-luci-mod-txtinfo))
+$(eval $(call BuildPackage,olsrd-luci-mod-pgraph))
+$(eval $(call BuildPackage,olsrd-luci-mod-quagga))
+$(eval $(call BuildPackage,olsrd-luci-mod-tas))
+
--- /dev/null
+config 'olsr' 'general'
+ option 'DebugLevel' '0'
+ option 'IpVersion' '4'
+ option 'AllowNoInt' 'yes'
+ option 'Pollrate' '0.025'
+ option 'TcRedundancy' '2'
+ option 'MprCoverage' '7'
+ option 'LinkQualityFishEye' '1'
+ option 'LinkQualityWinSize' '100'
+ option 'LinkQualityDijkstraLimit' '0 9.0'
+ option 'LinkQualityLevel' '2'
+ option 'UseHysteresis' 'no'
+
+config 'LoadPlugin' 'dyn_gw'
+ option 'Library' 'olsrd_dyn_gw.so.0.4'
+
+config 'LoadPlugin' 'nameservice'
+ option 'Library' 'olsrd_nameservice.so.0.3'
+ option 'suffix' '.olsr'
+ option 'latlon_infile' '/tmp/latlon.txt'
+ option 'hosts_file' '/var/etc/hosts'
+ option 'name' 'luci-node'
+
+config 'LoadPlugin' 'txtinfo'
+ option 'Library' 'olsrd_txtinfo.so.0.1'
+ option 'Accept' '127.0.0.1'
+
+config 'Interface'
+ option 'HelloInterval' '6.0'
+ option 'MidValidityTime' '324.0'
+ option 'TcInterval' '4.0'
+ option 'HnaValidityTime' '108.0'
+ option 'HelloValidityTime' '108.0'
+ option 'TcValidityTime' '324.0'
+ option 'HnaInterval' '18.0'
+ option 'MidInterval' '18.0'
+ option 'Interface' 'br-ff'
+
+config 'ipc' 'IpcConnect'
+ option 'MaxConnections' '0'
+ option 'Host' '127.0.0.1 10.0.0.5'
+ option 'Net' '192.168.1.0 255.255.255.0 10.0.0.0 255.0.0.0'
--- /dev/null
+#!/usr/bin/lua
+
+--[[
+
+OLSRd configuration generator
+(c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+]]--
+
+require("luci.util")
+require("luci.model.uci")
+
+local conf = luci.model.uci.get_all("olsr")
+
+local function _value(val)
+ if val:match("^[0-9%. \t]+$") or val == "yes" or val == "no" then
+ return val
+ else
+ return string.format( '"%s"', val )
+ end
+end
+
+local function _section(sect,sval,parstr)
+ local rv = ""
+ local pad = ""
+
+ if sval then
+ rv = string.format( '%s "%s"\n{\n', conf[sect][".type"], conf[sect][sval] )
+ pad = "\t"
+ end
+
+ for k, v in luci.util.spairs(conf[sect]) do
+ if k:sub(1,1) ~= '.' and k ~= sval then
+ if parstr then
+ rv = rv .. string.format(
+ '%s%s "%s"\t"%s"\n',
+ pad, parstr,
+ k:gsub( "_", "-" ), -- XXX: find a better solution for this
+ v
+ )
+ else
+ rv = rv .. string.format(
+ '%s%s\t%s\n',
+ pad, k, _value(v)
+ )
+ end
+ end
+ end
+
+ if sval then
+ rv = rv .. "}\n"
+ end
+
+ return rv
+end
+
+local function _hna(sval)
+ local rv = string.format( "%s\n{\n", sval )
+
+ for k, v in luci.util.spairs(conf) do
+ if conf[k][".type"] == sval and conf[k].NetAddr and conf[k].Prefix then
+ rv = rv .. string.format(
+ "\t%s\t%s\n",
+ conf[k].NetAddr,
+ conf[k].Prefix
+ )
+ end
+ end
+
+ return rv .. "}\n"
+end
+
+local function _ipc(sval)
+ local rv = string.format( "%s\n{\n", sval )
+
+ for k, v in luci.util.spairs(conf[sval]) do
+ if k:sub(1,1) ~= "." then
+ local vals = luci.util.split(v, "%s+", nil, true)
+
+ if k == "Net" then
+ for i = 1,#vals,2 do
+ rv = rv .. string.format(
+ "\tNet\t%s\t%s\n",
+ vals[i], vals[i+1]
+ )
+ end
+ elseif k == "Host" then
+ for i, v in ipairs(vals) do
+ rv = rv .. string.format(
+ "\t%s\t%s\n",
+ k, vals[i]
+ )
+ end
+ else
+ rv = rv .. string.format(
+ "\t%s\t%s\n",
+ k, v
+ )
+ end
+ end
+ end
+
+ return rv .. "}\n"
+end
+
+
+-- general config section
+print( _section("general") )
+
+-- plugin config sections
+for k, v in luci.util.spairs(conf) do
+ if conf[k][".type"] == "LoadPlugin" then
+ print( _section( k, "Library", "PlParam" ) )
+ end
+end
+
+-- interface config sections
+for k, v in luci.util.spairs(conf) do
+ if conf[k][".type"] == "Interface" then
+ print( _section( k, "Interface" ) )
+ end
+end
+
+-- write Hna4, Hna6 sections
+print( _hna("Hna4") )
+print( _hna("Hna6") )
+
+-- write IpcConnect section
+print( _ipc("IpcConnect") )