Add v0.8.2 OONF build files
This commit is contained in:
parent
d7b3bbc896
commit
45fc164df8
12 changed files with 697 additions and 0 deletions
67
oonf-dlep-proxy/Makefile
Normal file
67
oonf-dlep-proxy/Makefile
Normal file
|
@ -0,0 +1,67 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=oonf-dlep-proxy
|
||||
PKG_VERSION:=0.8.2
|
||||
PKG_REV:=3ff448e33f1ea9dde8c74397028067caf3c65406
|
||||
PKG_RELEASE:=$(PKG_REV)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=http://olsr.org/git/oonf.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=$(PKG_REV)
|
||||
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
CMAKE_OPTIONS=-D OONF_NO_WERROR:Bool=true \
|
||||
-D OONF_LOGGING_LEVEL:String=debug \
|
||||
-D OONF_NO_TESTING:Bool=true \
|
||||
-D UCI:Bool=true \
|
||||
-D OONF_APP_DEFAULT_CFG_HANDLER:String=uci \
|
||||
-D OONF_STATIC_PLUGINS:String="class;clock;interface;layer2;packet_socket;socket;stream_socket;telnet;timer;viewer;os_clock;os_socket;os_interface;os_system;nl80211_listener;layer2info;systeminfo;cfg_uciloader;cfg_compact;dlep_proxy" \
|
||||
-D OONF_LIB_GIT:String=v$(PKG_VERSION)-archive \
|
||||
-D OONF_VERSION:String=$(PKG_VERSION) \
|
||||
-D INSTALL_LIB_DIR:Path=lib/oonf \
|
||||
-D INSTALL_INCLUDE_DIR:Path=include/oonf \
|
||||
-D INSTALL_CMAKE_DIR:Path=lib/oonf \
|
||||
-D CMAKE_PREFIX_PATH=$(STAGING_DIR)/usr
|
||||
|
||||
define Package/oonf-git/template
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
MAINTAINER:=Henning Rogge <hrogge@gmail.com>
|
||||
SUBMENU:=OLSR.org network framework
|
||||
URL:=http://www.olsr.org/
|
||||
endef
|
||||
|
||||
define Package/oonf-dlep-proxy
|
||||
$(call Package/oonf-git/template)
|
||||
TITLE:= Build DLEP Radio+Router Agent
|
||||
DEPENDS:=+librt +libnl-tiny +libuci
|
||||
VERSION:=$(PKG_VERSION)
|
||||
endef
|
||||
|
||||
Build/Compile=$(call Build/Compile/Default,dlep_radio_static)
|
||||
Build/Install=
|
||||
|
||||
define Build/Install
|
||||
$(INSTALL_BIN) -D $(PKG_BUILD_DIR)/$(MAKE_PATH)/dlep_radio_static $(PKG_INSTALL_DIR)/usr/sbin/dlep_proxy;
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include -I${STAGING_DIR}/usr/include/libnl-tiny
|
||||
|
||||
define Package/oonf-dlep-proxy/install
|
||||
$(INSTALL_BIN) -D $(PKG_BUILD_DIR)/dlep_radio_static $(1)/usr/sbin/dlep_proxy
|
||||
$(INSTALL_BIN) -D ./files/dlep_proxy.init $(1)/etc/init.d/dlep_proxy
|
||||
$(INSTALL_BIN) -D ./files/dlep_proxy.hotplug $(1)/etc/hotplug.d/iface/50-dlep_proxy
|
||||
$(INSTALL_DATA) -D ./files/dlep_proxy.uci $(1)/etc/config/dlep_proxy
|
||||
endef
|
||||
|
||||
define Package/oonf-dlep-proxy/conffiles
|
||||
/etc/config/dlep_proxy
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,oonf-dlep-proxy))
|
12
oonf-dlep-proxy/files/dlep_proxy.hotplug
Executable file
12
oonf-dlep-proxy/files/dlep_proxy.hotplug
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
daemon=dlep_proxy
|
||||
|
||||
case "$ACTION" in
|
||||
ifup)
|
||||
. /etc/rc.common /etc/init.d/${daemon} enabled && {
|
||||
logger -t '${daemon}[hotplug]' -p daemon.info 'reloading configuration'
|
||||
. /etc/rc.common /etc/init.d/${daemon} reload
|
||||
}
|
||||
;;
|
||||
esac
|
124
oonf-dlep-proxy/files/dlep_proxy.init
Executable file
124
oonf-dlep-proxy/files/dlep_proxy.init
Executable file
|
@ -0,0 +1,124 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=82
|
||||
|
||||
daemon=dlep_proxy
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
oonf_log()
|
||||
{
|
||||
logger -s -t ${daemon} -p daemon.info "$1"
|
||||
}
|
||||
|
||||
oonf_get_layer3_device()
|
||||
{
|
||||
local interface="$1" # e.g. 'mywifi'
|
||||
local status dev proto
|
||||
local query="{ \"interface\" : \"$interface\" }"
|
||||
|
||||
status="$( ubus -S call network.interface status "$query" )" && {
|
||||
json_load "$status"
|
||||
json_get_var 'dev' l3_device
|
||||
json_get_var 'proto' proto
|
||||
case "$proto" in
|
||||
pppoe)
|
||||
# TODO: otherwise it segfaults
|
||||
oonf_log "refusing to add '$interface', because of proto '$proto'"
|
||||
;;
|
||||
*)
|
||||
echo "$dev" # e.g. 'wlan0-1'
|
||||
;;
|
||||
esac
|
||||
}
|
||||
}
|
||||
|
||||
oonf_add_devices_to_configuration()
|
||||
{
|
||||
local i=0
|
||||
local device_name= section= interface= single_interface=
|
||||
|
||||
# make a copy of configuration and
|
||||
# add a 'name' (physical name) for all
|
||||
# 'interface-names' (e.g. mywifi)
|
||||
#
|
||||
# olsrd2.@interface[2]=interface
|
||||
# olsrd2.@interface[2].ifname='wan lan wlanadhoc wlanadhocRADIO1'
|
||||
|
||||
# /var is in ramdisc/tmpfs
|
||||
cp /etc/config/${daemon} /var/etc/${daemon}_dev
|
||||
|
||||
while section="$( uci -q -c /etc/config get "${daemon}.@[$i]" )"; do {
|
||||
echo "section: $section"
|
||||
|
||||
interface="$( uci -q -c /etc/config get "${daemon}.@[$i].ifname" )" || {
|
||||
i=$(( $i + 1 ))
|
||||
continue
|
||||
}
|
||||
|
||||
case "$( uci -q get "${daemon}.@[$i].ignore" )" in
|
||||
1|on|true|enabled|yes)
|
||||
oonf_log "removing/ignore section '$section'"
|
||||
uci -q -c /var/etc delete "${daemon}_dev.@[$j]"
|
||||
i=$(( $i + 1 ))
|
||||
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
for single_interface in $interface; do {
|
||||
device_name="$( oonf_get_layer3_device "$single_interface" )"
|
||||
|
||||
echo "Interface: $single_interface = $device_name"
|
||||
|
||||
if [ ! -z "$device_name" ]
|
||||
then
|
||||
# add option 'name' for 'ifname' (e.g. 'mywifi')
|
||||
uci -q -c /var/etc add_list "${daemon}_dev.@[$i].name=$device_name"
|
||||
fi
|
||||
} done
|
||||
i=$(( $i + 1 ))
|
||||
} done
|
||||
|
||||
uci -q -c /var/etc commit ${daemon}_dev
|
||||
|
||||
oonf_log "wrote '/var/etc/${daemon}_dev'"
|
||||
}
|
||||
|
||||
oonf_reread_config()
|
||||
{
|
||||
local pid
|
||||
local pidfile='/var/run/${daemon}.pid'
|
||||
|
||||
if [ -e "$pidfile" ]; then
|
||||
read pid <"$pidfile"
|
||||
elif pidfile="$( uci -q get '${daemon}.@global[0].pidfile' )"; then
|
||||
read pid <"$pidfile"
|
||||
fi
|
||||
|
||||
# if empty, ask kernel
|
||||
pid="${pid:-$( pidof ${daemon} )}"
|
||||
|
||||
[ -n "$pid" ] && kill -SIGHUP $pid
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
oonf_add_devices_to_configuration
|
||||
|
||||
# produce coredumps
|
||||
ulimit -c unlimited
|
||||
|
||||
service_start /usr/sbin/${daemon} --set global.fork=true --load uci:///var/etc/${daemon}_dev
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
service_stop /usr/sbin/${daemon}
|
||||
}
|
||||
|
||||
reload()
|
||||
{
|
||||
oonf_add_devices_to_configuration
|
||||
oonf_reread_config
|
||||
}
|
24
oonf-dlep-proxy/files/dlep_proxy.uci
Normal file
24
oonf-dlep-proxy/files/dlep_proxy.uci
Normal file
|
@ -0,0 +1,24 @@
|
|||
config global
|
||||
option 'failfast' 'no'
|
||||
option 'pidfile' '/var/run/dlep_proxy.pid'
|
||||
option 'lockfile' '/var/lock/dlep_proxy'
|
||||
|
||||
config log
|
||||
option 'syslog' 'true'
|
||||
option 'stderr' 'true'
|
||||
# option 'file' '/var/log/dlep_proxy.log'
|
||||
# option 'info' 'all'
|
||||
# option 'debug' 'all'
|
||||
|
||||
config telnet
|
||||
# option 'port' '2009'
|
||||
|
||||
#config dlep_radio
|
||||
# list 'name' 'eth0'
|
||||
# option 'datapath_if' 'eth1'
|
||||
# option 'not_proxied' 'false'
|
||||
# option 'proxied' 'true'
|
||||
|
||||
#config dlep-router
|
||||
# list 'name' 'eth0'
|
||||
# option 'datapath_if' 'eth0'
|
67
oonf-dlep-radio/Makefile
Normal file
67
oonf-dlep-radio/Makefile
Normal file
|
@ -0,0 +1,67 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=oonf-dlep-radio
|
||||
PKG_VERSION:=0.8.2
|
||||
PKG_REV:=3ff448e33f1ea9dde8c74397028067caf3c65406
|
||||
PKG_RELEASE:=$(PKG_REV)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=http://olsr.org/git/oonf.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=$(PKG_REV)
|
||||
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
CMAKE_OPTIONS=-D OONF_NO_WERROR:Bool=true \
|
||||
-D OONF_LOGGING_LEVEL:String=debug \
|
||||
-D OONF_NO_TESTING:Bool=true \
|
||||
-D UCI:Bool=true \
|
||||
-D OONF_APP_DEFAULT_CFG_HANDLER:String=uci \
|
||||
-D OONF_STATIC_PLUGINS:String="class;clock;interface;layer2;packet_socket;socket;stream_socket;telnet;timer;viewer;os_clock;os_socket;os_interface;os_system;nl80211_listener;layer2info;systeminfo;cfg_uciloader;cfg_compact;dlep_radio" \
|
||||
-D OONF_LIB_GIT:String=v$(PKG_VERSION)-archive \
|
||||
-D OONF_VERSION:String=$(PKG_VERSION) \
|
||||
-D INSTALL_LIB_DIR:Path=lib/oonf \
|
||||
-D INSTALL_INCLUDE_DIR:Path=include/oonf \
|
||||
-D INSTALL_CMAKE_DIR:Path=lib/oonf \
|
||||
-D CMAKE_PREFIX_PATH=$(STAGING_DIR)/usr
|
||||
|
||||
define Package/oonf-git/template
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
MAINTAINER:=Henning Rogge <hrogge@gmail.com>
|
||||
SUBMENU:=OLSR.org network framework
|
||||
URL:=http://www.olsr.org/
|
||||
endef
|
||||
|
||||
define Package/oonf-dlep-radio
|
||||
$(call Package/oonf-git/template)
|
||||
TITLE:= Build DLEP Radio Agent
|
||||
DEPENDS:=+librt +libnl-tiny +libuci
|
||||
VERSION:=$(PKG_VERSION)
|
||||
endef
|
||||
|
||||
Build/Compile=$(call Build/Compile/Default,dlep_radio_static)
|
||||
Build/Install=
|
||||
|
||||
define Build/Install
|
||||
$(INSTALL_BIN) -D $(PKG_BUILD_DIR)/$(MAKE_PATH)/dlep_radio_static $(PKG_INSTALL_DIR)/usr/sbin/dlep_radio;
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include -I${STAGING_DIR}/usr/include/libnl-tiny
|
||||
|
||||
define Package/oonf-dlep-radio/install
|
||||
$(INSTALL_BIN) -D $(PKG_BUILD_DIR)/dlep_radio_static $(1)/usr/sbin/dlep_radio
|
||||
$(INSTALL_BIN) -D ./files/dlep_radio.init $(1)/etc/init.d/dlep_radio
|
||||
$(INSTALL_BIN) -D ./files/dlep_radio.hotplug $(1)/etc/hotplug.d/iface/50-dlep_radio
|
||||
$(INSTALL_DATA) -D ./files/dlep_radio.uci $(1)/etc/config/dlep_radio
|
||||
endef
|
||||
|
||||
define Package/oonf-dlep-radio/conffiles
|
||||
/etc/config/dlep_radio
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,oonf-dlep-radio))
|
12
oonf-dlep-radio/files/dlep_radio.hotplug
Executable file
12
oonf-dlep-radio/files/dlep_radio.hotplug
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
daemon=dlep_radio
|
||||
|
||||
case "$ACTION" in
|
||||
ifup)
|
||||
. /etc/rc.common /etc/init.d/${daemon} enabled && {
|
||||
logger -t '${daemon}[hotplug]' -p daemon.info 'reloading configuration'
|
||||
. /etc/rc.common /etc/init.d/${daemon} reload
|
||||
}
|
||||
;;
|
||||
esac
|
124
oonf-dlep-radio/files/dlep_radio.init
Executable file
124
oonf-dlep-radio/files/dlep_radio.init
Executable file
|
@ -0,0 +1,124 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=82
|
||||
|
||||
daemon=dlep_radio
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
oonf_log()
|
||||
{
|
||||
logger -s -t ${daemon} -p daemon.info "$1"
|
||||
}
|
||||
|
||||
oonf_get_layer3_device()
|
||||
{
|
||||
local interface="$1" # e.g. 'mywifi'
|
||||
local status dev proto
|
||||
local query="{ \"interface\" : \"$interface\" }"
|
||||
|
||||
status="$( ubus -S call network.interface status "$query" )" && {
|
||||
json_load "$status"
|
||||
json_get_var 'dev' l3_device
|
||||
json_get_var 'proto' proto
|
||||
case "$proto" in
|
||||
pppoe)
|
||||
# TODO: otherwise it segfaults
|
||||
oonf_log "refusing to add '$interface', because of proto '$proto'"
|
||||
;;
|
||||
*)
|
||||
echo "$dev" # e.g. 'wlan0-1'
|
||||
;;
|
||||
esac
|
||||
}
|
||||
}
|
||||
|
||||
oonf_add_devices_to_configuration()
|
||||
{
|
||||
local i=0
|
||||
local device_name= section= interface= single_interface=
|
||||
|
||||
# make a copy of configuration and
|
||||
# add a 'name' (physical name) for all
|
||||
# 'interface-names' (e.g. mywifi)
|
||||
#
|
||||
# olsrd2.@interface[2]=interface
|
||||
# olsrd2.@interface[2].ifname='wan lan wlanadhoc wlanadhocRADIO1'
|
||||
|
||||
# /var is in ramdisc/tmpfs
|
||||
cp /etc/config/${daemon} /var/etc/${daemon}_dev
|
||||
|
||||
while section="$( uci -q -c /etc/config get "${daemon}.@[$i]" )"; do {
|
||||
echo "section: $section"
|
||||
|
||||
interface="$( uci -q -c /etc/config get "${daemon}.@[$i].ifname" )" || {
|
||||
i=$(( $i + 1 ))
|
||||
continue
|
||||
}
|
||||
|
||||
case "$( uci -q get "${daemon}.@[$i].ignore" )" in
|
||||
1|on|true|enabled|yes)
|
||||
oonf_log "removing/ignore section '$section'"
|
||||
uci -q -c /var/etc delete "${daemon}_dev.@[$j]"
|
||||
i=$(( $i + 1 ))
|
||||
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
for single_interface in $interface; do {
|
||||
device_name="$( oonf_get_layer3_device "$single_interface" )"
|
||||
|
||||
echo "Interface: $single_interface = $device_name"
|
||||
|
||||
if [ ! -z "$device_name" ]
|
||||
then
|
||||
# add option 'name' for 'ifname' (e.g. 'mywifi')
|
||||
uci -q -c /var/etc add_list "${daemon}_dev.@[$i].name=$device_name"
|
||||
fi
|
||||
} done
|
||||
i=$(( $i + 1 ))
|
||||
} done
|
||||
|
||||
uci -q -c /var/etc commit ${daemon}_dev
|
||||
|
||||
oonf_log "wrote '/var/etc/${daemon}_dev'"
|
||||
}
|
||||
|
||||
oonf_reread_config()
|
||||
{
|
||||
local pid
|
||||
local pidfile='/var/run/${daemon}.pid'
|
||||
|
||||
if [ -e "$pidfile" ]; then
|
||||
read pid <"$pidfile"
|
||||
elif pidfile="$( uci -q get '${daemon}.@global[0].pidfile' )"; then
|
||||
read pid <"$pidfile"
|
||||
fi
|
||||
|
||||
# if empty, ask kernel
|
||||
pid="${pid:-$( pidof ${daemon} )}"
|
||||
|
||||
[ -n "$pid" ] && kill -SIGHUP $pid
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
oonf_add_devices_to_configuration
|
||||
|
||||
# produce coredumps
|
||||
ulimit -c unlimited
|
||||
|
||||
service_start /usr/sbin/${daemon} --set global.fork=true --load uci:///var/etc/${daemon}_dev
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
service_stop /usr/sbin/${daemon}
|
||||
}
|
||||
|
||||
reload()
|
||||
{
|
||||
oonf_add_devices_to_configuration
|
||||
oonf_reread_config
|
||||
}
|
24
oonf-dlep-radio/files/dlep_radio.uci
Normal file
24
oonf-dlep-radio/files/dlep_radio.uci
Normal file
|
@ -0,0 +1,24 @@
|
|||
config global
|
||||
option 'failfast' 'no'
|
||||
option 'pidfile' '/var/run/dlep_radio.pid'
|
||||
option 'lockfile' '/var/lock/dlep_radio'
|
||||
|
||||
config log
|
||||
option 'syslog' 'true'
|
||||
option 'stderr' 'true'
|
||||
# option 'file' '/var/log/dlep_radio.log'
|
||||
# option 'info' 'all'
|
||||
# option 'debug' 'all'
|
||||
|
||||
config telnet
|
||||
# option 'port' '2009'
|
||||
|
||||
config dlep_radio
|
||||
list 'name' 'wlan0'
|
||||
option 'datapath_if' 'br-lan'
|
||||
option 'not_proxied' 'false'
|
||||
option 'proxied' 'true'
|
||||
|
||||
config nl80211_listener
|
||||
option 'if' 'wlan0'
|
||||
option 'interval' '1.0'
|
67
oonf-olsrd2/Makefile
Normal file
67
oonf-olsrd2/Makefile
Normal file
|
@ -0,0 +1,67 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=oonf-olsrd2
|
||||
PKG_VERSION:=0.8.2
|
||||
PKG_REV:=3ff448e33f1ea9dde8c74397028067caf3c65406
|
||||
PKG_RELEASE:=$(PKG_REV)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=http://olsr.org/git/oonf.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=$(PKG_REV)
|
||||
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
CMAKE_OPTIONS=-D OONF_NO_WERROR:Bool=true \
|
||||
-D OONF_LOGGING_LEVEL:String=debug \
|
||||
-D OONF_NO_TESTING:Bool=true \
|
||||
-D UCI:Bool=true \
|
||||
-D OONF_APP_DEFAULT_CFG_HANDLER:String=uci \
|
||||
-D OONF_STATIC_PLUGINS:String="class;clock;duplicate_set;interface;layer2;packet_socket;rfc5444;socket;stream_socket;telnet;timer;viewer;os_clock;os_socket;os_interface;os_routing;os_system;nhdp;olsrv2;ff_dat_metric;neighbor_probing;nl80211_listener;link_config;layer2info;systeminfo;cfg_uciloader;cfg_compact;nhdpinfo;olsrv2info;json_for_networks" \
|
||||
-D OONF_LIB_GIT:String=v$(PKG_VERSION)-archive \
|
||||
-D OONF_VERSION:String=$(PKG_VERSION) \
|
||||
-D INSTALL_LIB_DIR:Path=lib/oonf \
|
||||
-D INSTALL_INCLUDE_DIR:Path=include/oonf \
|
||||
-D INSTALL_CMAKE_DIR:Path=lib/oonf \
|
||||
-D CMAKE_PREFIX_PATH=$(STAGING_DIR)/usr
|
||||
|
||||
define Package/oonf-git/template
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
MAINTAINER:=Henning Rogge <hrogge@gmail.com>
|
||||
SUBMENU:=OLSR.org network framework
|
||||
URL:=http://www.olsr.org/
|
||||
endef
|
||||
|
||||
define Package/oonf-olsrd2
|
||||
$(call Package/oonf-git/template)
|
||||
TITLE:= Build Olsrd V2 Routing Agent
|
||||
DEPENDS:=+librt +libnl-tiny +libuci
|
||||
VERSION:=$(PKG_VERSION)
|
||||
endef
|
||||
|
||||
Build/Compile=$(call Build/Compile/Default,olsrd2_static)
|
||||
Build/Install=
|
||||
|
||||
define Build/Install
|
||||
$(INSTALL_BIN) -D $(PKG_BUILD_DIR)/$(MAKE_PATH)/olsrd2_static $(PKG_INSTALL_DIR)/usr/sbin/olsrd2;
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include -I${STAGING_DIR}/usr/include/libnl-tiny
|
||||
|
||||
define Package/oonf-olsrd2/install
|
||||
$(INSTALL_BIN) -D $(PKG_BUILD_DIR)/olsrd2_static $(1)/usr/sbin/olsrd2
|
||||
$(INSTALL_BIN) -D ./files/olsrd2.init $(1)/etc/init.d/olsrd2
|
||||
$(INSTALL_BIN) -D ./files/olsrd2.hotplug $(1)/etc/hotplug.d/iface/50-olsrd2
|
||||
$(INSTALL_DATA) -D ./files/olsrd2.uci $(1)/etc/config/olsrd2
|
||||
endef
|
||||
|
||||
define Package/oonf-olsrd2/conffiles
|
||||
/etc/config/olsrd2
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,oonf-olsrd2))
|
12
oonf-olsrd2/files/olsrd2.hotplug
Executable file
12
oonf-olsrd2/files/olsrd2.hotplug
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
daemon=olsrd2
|
||||
|
||||
case "$ACTION" in
|
||||
ifup)
|
||||
. /etc/rc.common /etc/init.d/${daemon} enabled && {
|
||||
logger -t '${daemon}[hotplug]' -p daemon.info 'reloading configuration'
|
||||
. /etc/rc.common /etc/init.d/${daemon} reload
|
||||
}
|
||||
;;
|
||||
esac
|
124
oonf-olsrd2/files/olsrd2.init
Executable file
124
oonf-olsrd2/files/olsrd2.init
Executable file
|
@ -0,0 +1,124 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=82
|
||||
|
||||
daemon=olsrd2
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
oonf_log()
|
||||
{
|
||||
logger -s -t ${daemon} -p daemon.info "$1"
|
||||
}
|
||||
|
||||
oonf_get_layer3_device()
|
||||
{
|
||||
local interface="$1" # e.g. 'mywifi'
|
||||
local status dev proto
|
||||
local query="{ \"interface\" : \"$interface\" }"
|
||||
|
||||
status="$( ubus -S call network.interface status "$query" )" && {
|
||||
json_load "$status"
|
||||
json_get_var 'dev' l3_device
|
||||
json_get_var 'proto' proto
|
||||
case "$proto" in
|
||||
pppoe)
|
||||
# TODO: otherwise it segfaults
|
||||
oonf_log "refusing to add '$interface', because of proto '$proto'"
|
||||
;;
|
||||
*)
|
||||
echo "$dev" # e.g. 'wlan0-1'
|
||||
;;
|
||||
esac
|
||||
}
|
||||
}
|
||||
|
||||
oonf_add_devices_to_configuration()
|
||||
{
|
||||
local i=0
|
||||
local device_name= section= interface= single_interface=
|
||||
|
||||
# make a copy of configuration and
|
||||
# add a 'name' (physical name) for all
|
||||
# 'interface-names' (e.g. mywifi)
|
||||
#
|
||||
# olsrd2.@interface[2]=interface
|
||||
# olsrd2.@interface[2].ifname='wan lan wlanadhoc wlanadhocRADIO1'
|
||||
|
||||
# /var is in ramdisc/tmpfs
|
||||
cp /etc/config/${daemon} /var/etc/${daemon}_dev
|
||||
|
||||
while section="$( uci -q -c /etc/config get "${daemon}.@[$i]" )"; do {
|
||||
echo "section: $section"
|
||||
|
||||
interface="$( uci -q -c /etc/config get "${daemon}.@[$i].ifname" )" || {
|
||||
i=$(( $i + 1 ))
|
||||
continue
|
||||
}
|
||||
|
||||
case "$( uci -q get "${daemon}.@[$i].ignore" )" in
|
||||
1|on|true|enabled|yes)
|
||||
oonf_log "removing/ignore section '$section'"
|
||||
uci -q -c /var/etc delete "${daemon}_dev.@[$j]"
|
||||
i=$(( $i + 1 ))
|
||||
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
for single_interface in $interface; do {
|
||||
device_name="$( oonf_get_layer3_device "$single_interface" )"
|
||||
|
||||
echo "Interface: $single_interface = $device_name"
|
||||
|
||||
if [ ! -z "$device_name" ]
|
||||
then
|
||||
# add option 'name' for 'ifname' (e.g. 'mywifi')
|
||||
uci -q -c /var/etc add_list "${daemon}_dev.@[$i].name=$device_name"
|
||||
fi
|
||||
} done
|
||||
i=$(( $i + 1 ))
|
||||
} done
|
||||
|
||||
uci -q -c /var/etc commit ${daemon}_dev
|
||||
|
||||
oonf_log "wrote '/var/etc/${daemon}_dev'"
|
||||
}
|
||||
|
||||
oonf_reread_config()
|
||||
{
|
||||
local pid
|
||||
local pidfile='/var/run/${daemon}.pid'
|
||||
|
||||
if [ -e "$pidfile" ]; then
|
||||
read pid <"$pidfile"
|
||||
elif pidfile="$( uci -q get '${daemon}.@global[0].pidfile' )"; then
|
||||
read pid <"$pidfile"
|
||||
fi
|
||||
|
||||
# if empty, ask kernel
|
||||
pid="${pid:-$( pidof ${daemon} )}"
|
||||
|
||||
[ -n "$pid" ] && kill -SIGHUP $pid
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
oonf_add_devices_to_configuration
|
||||
|
||||
# produce coredumps
|
||||
ulimit -c unlimited
|
||||
|
||||
service_start /usr/sbin/${daemon} --set global.fork=true --load uci:///var/etc/${daemon}_dev
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
service_stop /usr/sbin/${daemon}
|
||||
}
|
||||
|
||||
reload()
|
||||
{
|
||||
oonf_add_devices_to_configuration
|
||||
oonf_reread_config
|
||||
}
|
40
oonf-olsrd2/files/olsrd2.uci
Normal file
40
oonf-olsrd2/files/olsrd2.uci
Normal file
|
@ -0,0 +1,40 @@
|
|||
config global
|
||||
option 'failfast' 'no'
|
||||
option 'pidfile' '/var/run/olsrd2.pid'
|
||||
option 'lockfile' '/var/lock/olsrd2'
|
||||
|
||||
config log
|
||||
option 'syslog' 'true'
|
||||
option 'stderr' 'true'
|
||||
# option 'file' '/var/log/olsrd2.log'
|
||||
# option 'info' 'all'
|
||||
# option 'debug' 'all'
|
||||
|
||||
config telnet
|
||||
# option 'port' '2009'
|
||||
|
||||
config olsrv2
|
||||
# list 'lan' '::/0'
|
||||
# list 'lan' '0.0.0.0/0'
|
||||
|
||||
config interface
|
||||
option 'ifname' 'loopback'
|
||||
|
||||
config interface
|
||||
list 'ifname' 'WIFI'
|
||||
list 'ifname' 'wlanadhoc'
|
||||
list 'ifname' 'wlanadhocRADIO1'
|
||||
|
||||
config interface
|
||||
list 'ifname' 'wan'
|
||||
option 'ignore' '1'
|
||||
# option 'rx_bitrate' '100M'
|
||||
# option 'tx_bitrate' '100M'
|
||||
# option 'signal' '-20'
|
||||
|
||||
config interface
|
||||
list 'ifname' 'lan'
|
||||
option 'ignore' '1'
|
||||
# option 'rx_bitrate' '1G'
|
||||
# option 'tx_bitrate' '1G'
|
||||
# option 'signal' '-10'
|
Loading…
Reference in a new issue